https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86175

            Bug ID: 86175
           Summary: LTO code generator does not respect ld -u option to
                    force symbol inclusion in the link product
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zenith432 at users dot sourceforge.net
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44288
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44288&action=edit
Test case to demonstrate bug

Please see test case in attached file that contains
Makefile
test.c

GCC is 8.1.1
ld is from binutils 2.29.1

Compiling with -flto and attempting to force inclusion of a symbol with hidden
visibility.  The symbol is discarded.

make
gcc -o test1       -fvisibility=default -ffunction-sections
-Wl,--gc-sections,-u,KeepMe test.c
strings test1 | grep This
This string should appear in the executable.
gcc -o test2 -flto -fvisibility=default -ffunction-sections
-Wl,--gc-sections,-u,KeepMe test.c
strings test2 | grep This
This string should appear in the executable.
gcc -o test3       -fvisibility=hidden  -ffunction-sections
-Wl,--gc-sections,-u,KeepMe test.c
strings test3 | grep This
This string should appear in the executable.
gcc -o test4 -flto -fvisibility=hidden  -ffunction-sections
-Wl,--gc-sections,-u,KeepMe test.c
strings test4 | grep This
make: [Makefile:18: test4] Error 1 (ignored)

Reply via email to