https://llvm.org/bugs/show_bug.cgi?id=25286

            Bug ID: 25286
           Summary: Profile Instrumentation and linker (gnu) garbage
                    collection
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: davi...@google.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

If you use the latest clang to build an instrumented executable or shared
library with garbage collection turned on, you will get a linker error if the
linker is gnu ld:

clang -fprofile-instr-generate -fdata-sections -ffunction-sections
-Wl,--gc-sections t.c


The affected platform is Linux and FreeBSD. This is basically a gnu linker bug:

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


It is possible to workaround this by changing clang driver, but the solution is
hacky and temporary, so not desirable.

If you hit the problem, here are three solutions:

1) update the gnu linker (when the fix is released)
2) use gold linker: -fuse-ld=gold
3) use the following linker script -- name it prf_data.x


SECTIONS {
__llvm_prf_data : { KEEP(*(__llvm_prf_data)) }
}

and add the following link option: -Wl,-T,prf_data.x


Keep this bug open as a place holder to document the issue.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to