bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/21557] New: __start_SCN not provided if SCN used in linker scrip


From: amonakov at gmail dot com
Subject: [Bug ld/21557] New: __start_SCN not provided if SCN used in linker script
Date: Thu, 08 Jun 2017 17:26:23 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=21557

            Bug ID: 21557
           Summary: __start_SCN not provided if SCN used in linker script
           Product: binutils
           Version: 2.29 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: amonakov at gmail dot com
  Target Milestone: ---

It appears that automagic provision of __start_/__stop_SCN symbol names doesn't
work in BFD linker (works in Gold) if the section in question participates in
linker script SECTIONS command, even though computing reachability for the
purposes of --gc-sections works as expected.

cat <<EOF >test.s
        .section        scnfoo,"aw",@progbits
        .type   foo, @object
        .size   foo, 1
foo:
        .zero   1
        .globl  bar
        .data
        .align 8
        .type   bar, @object
        .size   bar, 8
bar:
        .quad   __start_scnfoo
EOF

cat <<EOF >lds
SECTIONS {
        scnfoo : { *(scnfoo) }
}
EOF

gcc -B. -fuse-ld=bfd -shared -o test.so test.o -Wl,-z,defs -T lds
test.o:(.data+0x0): undefined reference to `__start_scnfoo'


(this issue is minimized from analyzing why Glibc libc.so gets mislinked with
--gc-sections, but the original Glibc issue is different: they use PROVIDE
statements overriding magic symbols:

         PROVIDE(__start___libc_subfreeres = .);
         __libc_subfreeres : { *(__libc_subfreeres) }
         PROVIDE(__stop___libc_subfreeres = .);

and imho there the main question would be if linkers want to support such
usage, or Glibc would have to drop the now-useless PROVIDE statements to allow
building with --gc-sections, but that leads to the above ld.bfd bug)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]