https://sourceware.org/bugzilla/show_bug.cgi?id=30590
Bug ID: 30590 Summary: Section matching broken by prefix tree change (b1eecf6f66a4a642) Product: binutils Version: 2.40 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: andrewoates at gmail dot com Target Milestone: --- I have a basic linker script that stopped working after upgrading to binutils 2.40. I did a git bisect on the repository and it seems that the breakage starts with commit b1eecf6f66a4a642f4cb35688213e6c1c1ffdc79. My simplified test case is as follows: ##### $ cat test1.c int func3(void); int func1(void) { return func3(); } $ cat test2.c int func1(void); int func2(void) { return func1(); } $ (127) cat test3.c int func3(void) { return 0; } $ cat linker.ld ENTRY (func2) SECTIONS { . = 0x1000; .init-text ALIGN(4) : { lib1.a(*) } . = 0xc0000000; .text ALIGN(4) : { *(.text) } } #### If you then run $ ${LD} --version GNU ld (GNU Binutils) 2.39.50.20221130 Copyright (C) 2022 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. $ ar cr lib1.a test1.o test2.o $ ar cr lib2.a test3.o $ ${LD} -o out.bin -T linker.ld lib1.a lib2.a $ objdump -x out.bin | grep func c000001e g F .text 0000000a func3 c000000f g F .text 0000000f func1 c0000000 g F .text 0000000f func2 you see that func1 and func2 are in .text rather than .init-text where they should be. Running it compiled at 50be5d11289, you get the expected result: $ objdump -x out.bin | grep func c0000000 g F .text 0000000a func3 00001000 g F .init-text 0000000f func1 0000100f g F .init-text 0000000f func2 -- You are receiving this mail because: You are on the CC list for the bug.