bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/21571] --gc-sections doesn't work with PROVIDE in linker script


From: hjl.tools at gmail dot com
Subject: [Bug ld/21571] --gc-sections doesn't work with PROVIDE in linker script
Date: Mon, 12 Jun 2017 20:10:46 +0000

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|--gc-sections doesn'        |--gc-sections doesn't work
                   |                            |with PROVIDE in linker
                   |                            |script

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
address@hidden xxx]$ cat x.s
        .section        scnfoo,"aw",@progbits
        .zero 0x10

        .globl  bar
        .data
        .align 8
        .type   bar, @object
        .size   bar, 8
bar:
        .dc.a   __start_scnfoo
        .dc.a   __stop_scnfoo
address@hidden xxx]$ cat x.t
SECTIONS {
    .foo : {
        PROVIDE (__start_scnfoo = .);
        *(scnfoo)
        PROVIDE (__stop_scnfoo = .);
    }
}
address@hidden xxx]$ make
as  -o x.o x.s
./ld --gc-sections --print-gc-sections -shared -z defs -T x.t -o x.so  x.o
./ld: Removing unused section 'scnfoo' in file 'x.o'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  This is wrong.
readelf -sSW x.so | grep foo
     1: 00000000000001d0     0 NOTYPE  GLOBAL DEFAULT    6 __stop_scnfoo
     2: 00000000000001d0     0 NOTYPE  GLOBAL DEFAULT    6 __start_scnfoo
     9: 00000000000001d0     0 NOTYPE  GLOBAL DEFAULT    6 __stop_scnfoo
    10: 00000000000001d0     0 NOTYPE  GLOBAL DEFAULT    6 __start_scnfoo
address@hidden xxx]$

-- 
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]