[LLVMbugs] [Bug 21292] New: __attribute__((used)) possibly ignored for static function with inline assembler?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 15 15:06:08 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21292

            Bug ID: 21292
           Summary: __attribute__((used)) possibly ignored for static
                    function with inline assembler?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danalbert at google.com
                CC: llvmbugs at cs.uiuc.edu, srhines at google.com
    Classification: Unclassified

I've come across what looks like a bug in the integrated assembler. It looks
like __attribute__((used)) is being ignored.

We're seeing the following link error:
cxa_exception.o(.text.__cxa_end_cleanup+0x2): warning: relocation refers to
discarded section

The relocation at .text.__cxa_end_cleanup+0x2 is to:
https://github.com/llvm-mirror/libcxxabi/blob/master/src/cxa_exception.cpp#L314

Removing the static keyword allows it to pass, and removing the attribute
results in an undefined reference, so clearly used is having _some_ effect.

Our compilation line (pruned to remove the uninteresting android parts):

clang++ -I external/libcxxabi/include/ -I external/libcxx/include/ -I
external/libcxxabi -c -msoft-float -ffunction-sections -fdata-sections
-funwind-tables -fstack-protector -fno-short-enums -no-canonical-prefixes
-march=armv7-a -mfloat-abi=softfp -mfpu=neon -fmessage-length=0
-fvisibility-inlines-hidden -target arm-linux-androideabi -mthumb -Os
-fomit-frame-pointer -fno-strict-aliasing  -frtti   -fPIC   -std=c++11
-fexceptions -integrated-as external/libcxxabi/src/cxa_exception.cpp

More discussion: https://android-review.googlesource.com/#/c/110170/

Possibly related:
http://llvm.org/bugs/show_bug.cgi?id=19743
http://llvm.org/bugs/show_bug.cgi?id=17480

Our clang is based on r212749, so it's possible that this has been fixed
already.

-- 
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/20141015/b959dab3/attachment.html>


More information about the llvm-bugs mailing list