[llvm-bugs] [Bug 25286] New: Profile Instrumentation and linker (gnu) garbage collection

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 22 11:53:51 PDT 2015


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: unassignedbugs at nondot.org
          Reporter: davidxl at google.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151022/4849f0aa/attachment.html>


More information about the llvm-bugs mailing list