[LLVMbugs] [Bug 18489] New: section attribute behaviour differs from gcc's

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 15 07:28:05 PST 2014


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

            Bug ID: 18489
           Summary: section attribute behaviour differs from gcc's
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: patrick at georgi-clan.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

coreboot uses an (admittedly hackish) trick to move variables to a special
section[0]. When trying to compile this with clang, such variables end up in
.bss which is a problem for us.

A reduced test case, showing the different behaviour:
$ cat test.c; echo "--- clang follows ---"; Source/llvm-build/Release/bin/clang
-S test.c; grep "section" test.s; echo "--- gcc follows ---"; gcc -S test.c;
grep "section" test.s

static int foo __attribute__((section(".my.foo,\"w\", at nobits#")));

void do_this(void) { foo++; }
--- clang follows ---
.section    ".my.foo,\"w\", at nobits#","aw", at progbits
.section    ".note.GNU-stack","", at progbits
--- gcc follows ---
.section    .my.foo,"w", at nobits#,"aw", at progbits
.section    .note.GNU-stack,"", at progbits

[0]
http://review.coreboot.org/gitweb?p=coreboot.git;a=blob;f=src/arch/x86/include/arch/early_variables.h;h=ba7df97059e2c60a79bba9393c9e3ac4d34d9289;hb=78938481eb3b4a11950d7c37627bf4704eb6e7da#l24
- it's used like "int foo CAR_GLOBAL".

-- 
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/20140115/5200da06/attachment.html>


More information about the llvm-bugs mailing list