<html>
    <head>
      <base href="https://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 --- - Revisit how we handle conflicts with section symbols"
   href="https://llvm.org/bugs/show_bug.cgi?id=31850">31850</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Revisit how we handle conflicts with section symbols
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rafael.espindola@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The gnu assembler rejects

.section foo,"a",@progbits
foo:
.data
.quad foo

and accepts

foo:
.section foo,"a",@progbits
.data
.quad foo

producing a relocation with the section foo.

clang accepts both and produces relocations with the symbol.

The gas behaviour really doesn't seem intentional. There is no good reason to
prefer a section name over another symbol or vice versa.

The current clang behaviour was implemented in <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - section / global name conflict: error in backend: symbol 'xxx' is already defined"
   href="show_bug.cgi?id=26941">bug 26941</a>, but I think the
diagnostic there  is incorrect. The only reason gcc accepts

int xxx;
__attribute__((section("xxx"))) int f() { return xxx; }

is that gcc print ".comm xxx" before ".section xxx". The gnu assembler rejects
the current clang produced .s.

What <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - section / global name conflict: error in backend: symbol 'xxx' is already defined"
   href="show_bug.cgi?id=26941">bug 26941</a> is really about is a IR linker bug. From <a href="show_bug.cgi?id=31850#c5">comment 5</a> we see that
the section is from one file and the symbol from another. Just like with any
other local symbol, the IR linker should detect that it conflicts with a symbol
(the section symbol) in another module and rename it.

And I think MC should just reject both cases listed in this bug.</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>