aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorShahab Vahedi <shahab@synopsys.com>2020-07-30 18:40:41 +0200
committerClaudiu Zissulescu <claziss@gmail.com>2020-07-31 12:15:17 +0300
commit223d5266dec459e04d99d1140cfb7c28900e1507 (patch)
tree1e0dfb3bbd4cb5630c1d71ff4de8099418e4d8bf /bfd
parent15f2a3ede0b026887f861c8e9c23f82355289e46 (diff)
downloadgdb-223d5266dec459e04d99d1140cfb7c28900e1507.zip
gdb-223d5266dec459e04d99d1140cfb7c28900e1507.tar.gz
gdb-223d5266dec459e04d99d1140cfb7c28900e1507.tar.bz2
ARC: Fix ld/pr24511 test
With this patch, ld/pr24511 test passes for ARC. At first glance, the test was failing because the order of "__init_array_start" and "__fini_array_start" weak symbols were reversed: $ nm -n dump.out expected output | real output 00002104 D __init_array_start | 00002104 D __fini_array_start 0000210c D __fini_array_start | 00002104 D __init_array_start The order of the symbols are different as a side effect of both symbols being mapped to the _same_ address (0x2104). Looking further into the mapping logs [1] revealed that the linker script must consider all instances of ".init_array" (in other words ".init_array.*") inside its relevant section. Same logic holds for ".fini_array". Therefore, adding "KEEP (*(SORT(.init_array.*)))" to the linker script, along with the one for ".finit_array.*", resolved the problem. While at it, I took the liberty of refactoring the script a little bit and made those pieces of script macros. [1] Linker's mapping for the relevant part of the test --------------------------------------------------------------- .init_array 0x2104 0x0 0x2104 PROVIDE (__init_array_start = .) *(.init_array) [!provide] PROVIDE (__init_array_end = .) .fini_array 0x2104 0x0 0x2104 PROVIDE (__fini_array_start = .) *(.fini_array) [!provide] PROVIDE (__fini_array_end = .) .data 0x2104 0x0 *(.data .data.* .gnu.linkonce.d.*) .data 0x2104 0x0 pr24511.o .init_array.01000 0x2104 0x8 .init_array.01000 0x2104 0x8 pr24511.o .fini_array.01000 0x210c 0x8 .fini_array.01000 0x210c 0x8 pr24511.o --------------------------------------------------------------- ld: * scripttempl/elfarc.sc (.init_array): Keep ".init_array.*". (.fini_array): Keep ".fini_array.*". Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions