<div dir="ltr">On Sun, Sep 22, 2013 at 9:43 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div alink="#EE0000" bgcolor="#ffffff" link="#0B6CDA" text="#000000" vlink="#551A8B">
Hi Eli,<br>
<br>
Slightly changed the example :-<br>
<br>
.section somedata<br>
.Ltmpa:<br>
.word 100<br>
.Ltmpb:<br>
.word 60<br>
.Ltmpc:<br>
.word 40<br>
.Ltmpd:<br>
.word (.Ltmpa-.Ltmpb)-.Ltmpc<br>
<br>
The GNU assembler properly handles the above.<br>
<br>
$as -c x.s -o x.o<br>
$readelf -x 4 x.o<br>
<br>
Hex dump of section 'somedata':<br>
NOTE: This section has relocations against it, but these have NOT
been applied to this dump.<br>
0x00000000 64003c00 28000000 d.<.(...<br>
<font color="#ff0000">^^^^ (Calculated properly too!)</font><br>
With clang/llvm-mc <br>
<br>
$ llvm-mc -filetype=obj x.s -o x.o<div class="im"><br>
LLVM ERROR: expected relocatable expression<br>
<br></div>
Looks like llvm-mc is more restrictive ?<br>
<br><br></div></blockquote><div><br></div><div>Emitting the relocation in question requires *negating* the address of a variable. I could be wrong, but I'm pretty sure there isn't any way to represent that in ELF.<br>
<br>-Eli<br></div></div><br></div></div>