[Bug lto/89147] New: flto removes functions implemented in asm

Hi-Angel at yandex dot ru gcc-bugzilla@gcc.gnu.org
Thu Jan 31 22:52:00 GMT 2019


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

            Bug ID: 89147
           Summary: flto removes functions implemented in asm
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Hi-Angel at yandex dot ru
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

This came up while researching why -flto build of Mesa fails with linking
errors. The asm snippet below is from an auto-generated code.

Possible workarounds are welcome.

# Steps to reproduce (in terms of terminal commands):

        $ cat test.c                         
        __asm__( ".globl " "gl""NewList" "\n"
                         ".type " "gl""NewList" ", @function\n"
                         ".balign 16\n" "gl""NewList" ":""\n"
                         "\t""call x86_current_tls\n\t"
                         "movl %gs:(%eax), %eax\n\t"
                         "jmp *(4 * " "0" ")(%eax)""\n"
                         );
        $ gcc -O3 test.c -o test.o -c -flto
        $ nm test.o

# Expected

Output of `nm test.o`:
        0000000000000000 T glNewList
                                         U x86_current_tls

# Actual

Output of `nm test.o`: 
        nm: test.o: no symbols


More information about the Gcc-bugs mailing list