Changeset View
Changeset View
Standalone View
Standalone View
sys/conf/ldscript.set_pad
- This file was added.
/*- | |||||
* SPDX-License-Identifier: BSD-2-Clause | |||||
* | |||||
* Copyright (c) 2018 Bjoern A. Zeeb | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
/* | |||||
* This linker script (1/2) is used to determine whether a kernel module | |||||
* has a set_pcpu or a set_vnet section and record it in a new symbol. | |||||
* Neither the SIZEOF() not the output/inut section will create the section | |||||
* if it does not exist already. | |||||
* The new symbol is reduced to either 1 (if the section exist) or | |||||
* 0 (if the section does not exist). The value of the symbol will be | |||||
* used in the (2/2) linker script to enlarge (pad at the end) an already | |||||
* existing section by 1 byte. | |||||
* This is needed as the code generated on certain architectures for | |||||
* non-simple-types, e.g., an array can generate an absolute relocation | |||||
* on the edge (just outside) the section and thus will not be properly | |||||
* relocated. Adding the 1 byte pad to the end of the section will ensure | |||||
* that even absolute relocations of complex types will be inside the | |||||
* section, if they are the last object in there and hence relocation will | |||||
* work properly and avoid panics. | |||||
*/ | |||||
___set_pcpu_pad = ABSOLUTE ( SIZEOF(set_pcpu) ? 1 : 0 ) ; | |||||
SECTIONS | |||||
{ | |||||
set_pcpu : { *(set_pcpu) } | |||||
} | |||||
___set_vnet_pad = ABSOLUTE ( SIZEOF(set_vnet) ? 1 : 0 ) ; | |||||
SECTIONS | |||||
{ | |||||
set_vnet : { *(set_vnet) } | |||||
} | |||||
/* end */ |