2edab91c10
An assignment to dot in an output section that allocates space of course keeps the output section. Here, I'm changing the behaviour for assignments that don't allocate space. The idea is not so much to allow people to force output of an empty section with ". = .", but to fix cases where an otherwise empty section has padding added by an alignment expression that changes with relaxation or .eh_frame editing. Such a section might have zero size before relaxation and so be stripped incorrectly. ld/ * ld.texinfo (Output Section Discarding): Mention assigning to dot as a way of keeping otherwise empty sections. * ldexp.c (is_dot, is_value, is_sym_value, is_dot_ne_0, is_dot_plus_0, is_align_conditional): New predicates. (exp_fold_tree_1): Set SEC_KEEP when assigning to dot inside an output section, except for some special cases. * scripttempl/elfmicroblaze.sc: Use canonical form to align at end of .heap and .stack. ld/testsuite/ * ld-shared/elf-offset.ld: Align end of .bss with canonical form of ALIGN that allows an empty .bss to be removed. * ld-arm/arm-dyn.ld: Likewise. * ld-arm/arm-lib.ld: Likewise. * ld-elfvsb/elf-offset.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN. * ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section. ALIGN address of section instead. * ld-powerpc/vle-multiseg-2.ld: Likewise. * ld-powerpc/vle-multiseg-3.ld: Likewise. * ld-powerpc/vle-multiseg-4.ld: Likewise. * ld-powerpc/vle-multiseg-6.ld: Likewise. * ld-scripts/empty-aligned.d: Check section headers not program headers. Remove xfail and notarget. * ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.
35 lines
669 B
Plaintext
35 lines
669 B
Plaintext
MEMORY
|
|
{
|
|
vle_seg1 (rxw): org = 0x00000000, len = 0x10000
|
|
vle_seg2 (rxw): org = 0x00100000, len = 0x10000
|
|
nonvle_seg (rxw): org = 0x001F0000, len = 0x20000
|
|
}
|
|
SECTIONS
|
|
{
|
|
.data 0x00000100 :
|
|
{
|
|
*(.data)
|
|
*(.ctors)
|
|
*(.dtors)
|
|
*(.eh_frame)
|
|
*(.jcr)
|
|
}
|
|
.text_vle 0x00001000 :
|
|
{
|
|
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text*)
|
|
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.init*)
|
|
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.fini*)
|
|
} > vle_seg1
|
|
|
|
.text_iv 0x100000 :
|
|
{
|
|
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.text_iv)
|
|
INPUT_SECTION_FLAGS (SHF_PPC_VLE) *(.iv_handlers)
|
|
} >vle_seg2
|
|
|
|
.text 0x101000 :
|
|
{
|
|
INPUT_SECTION_FLAGS (!SHF_PPC_VLE) *(.text*)
|
|
}
|
|
}
|