<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - section attribute behaviour differs from gcc's"
   href="http://llvm.org/bugs/show_bug.cgi?id=18489">18489</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>section attribute behaviour differs from gcc's
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>patrick@georgi-clan.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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\",@nobits#")));

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

[0]
<a href="http://review.coreboot.org/gitweb?p=coreboot.git;a=blob;f=src/arch/x86/include/arch/early_variables.h;h=ba7df97059e2c60a79bba9393c9e3ac4d34d9289;hb=78938481eb3b4a11950d7c37627bf4704eb6e7da#l24">http://review.coreboot.org/gitweb?p=coreboot.git;a=blob;f=src/arch/x86/include/arch/early_variables.h;h=ba7df97059e2c60a79bba9393c9e3ac4d34d9289;hb=78938481eb3b4a11950d7c37627bf4704eb6e7da#l24</a>
- it's used like "int foo CAR_GLOBAL".</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>