<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 --- - llvm produces an invalid Mach-O from a valid IR"
href="http://llvm.org/bugs/show_bug.cgi?id=18743">18743</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm produces an invalid Mach-O from a valid IR
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rafael.espindola@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>glider@google.com, isanbard@gmail.com, kledzik@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The IR
@foo = private constant i32 42
is perfectly valid according to the language reference. It works correctly when
producing ELF and COFF, but when producing MachO llc prints
.section __TEXT,__const
L_foo: ## @foo
.asciz "abc"
but from the discussion on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - r187827 caused 1.5% size regression under AddressSanitizer"
href="show_bug.cgi?id=17976">bug 17976</a> it is known that putting a L symbol in
__const in invalid. The issue being that the linker depends on seeing all the
symbols in order to split the section into atoms. The invisible constant would
be included in the previous symbol.
Would it OK with the linker to use another section? For example, would this be
OK?:
.section __TEXT,__const_no_atom
.align 2 ## @foo
L_foo:
.long 42 ## 0x2a
If not, the two remaining options I can see are:
* Make private a best effort thing and print
.section __TEXT,__const
.align 2 ## @foo
l_foo:
* Declare defeat and just reject that IR when targeting MachO, leaving the
responsibility with the FE to produce something else.</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>