Shankar Easwaran
2013-Sep-23 04:43 UTC
[LLVMdev] LLVM ERROR: expected relocatable expression
Hi Eli, Slightly changed the example :- .section somedata .Ltmpa: .word 100 .Ltmpb: .word 60 .Ltmpc: .word 40 .Ltmpd: .word (.Ltmpa-.Ltmpb)-.Ltmpc The GNU assembler properly handles the above. $as -c x.s -o x.o $readelf -x 4 x.o Hex dump of section 'somedata': NOTE: This section has relocations against it, but these have NOT been applied to this dump. 0x00000000 64003c00 28000000 d.<.(... ^^^^ (Calculated properly too!) With clang/llvm-mc $ llvm-mc -filetype=obj x.s -o x.o LLVM ERROR: expected relocatable expression Looks like llvm-mc is more restrictive ? Thanks Shankar Easwaran -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130922/20edc76e/attachment.html>
On Sun, Sep 22, 2013 at 9:43 PM, Shankar Easwaran <shankare at codeaurora.org>wrote:> Hi Eli, > > Slightly changed the example :- > > .section somedata > .Ltmpa: > .word 100 > .Ltmpb: > .word 60 > .Ltmpc: > .word 40 > .Ltmpd: > .word (.Ltmpa-.Ltmpb)-.Ltmpc > > The GNU assembler properly handles the above. > > $as -c x.s -o x.o > $readelf -x 4 x.o > > Hex dump of section 'somedata': > NOTE: This section has relocations against it, but these have NOT been > applied to this dump. > 0x00000000 64003c00 28000000 d.<.(... > ^^^^ (Calculated > properly too!) > With clang/llvm-mc > > $ llvm-mc -filetype=obj x.s -o x.o > > LLVM ERROR: expected relocatable expression > > Looks like llvm-mc is more restrictive ? > > >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. -Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130922/f4cfbcd4/attachment.html>
Shankar Easwaran
2013-Sep-23 13:05 UTC
[LLVMdev] LLVM ERROR: expected relocatable expression
On 9/23/2013 1:45 AM, Eli Friedman wrote:> On Sun, Sep 22, 2013 at 9:43 PM, Shankar Easwaran > <shankare at codeaurora.org <mailto:shankare at codeaurora.org>> wrote: > > Hi Eli, > > Slightly changed the example :- > > .section somedata > .Ltmpa: > .word 100 > .Ltmpb: > .word 60 > .Ltmpc: > .word 40 > .Ltmpd: > .word (.Ltmpa-.Ltmpb)-.Ltmpc > > The GNU assembler properly handles the above. > > $as -c x.s -o x.o > $readelf -x 4 x.o > > Hex dump of section 'somedata': > NOTE: This section has relocations against it, but these have NOT > been applied to this dump. > 0x00000000 64003c00 28000000 d.<.(... > ^^^^ (Calculated properly too!) > With clang/llvm-mc > > $ llvm-mc -filetype=obj x.s -o x.o > > LLVM ERROR: expected relocatable expression > > Looks like llvm-mc is more restrictive ? > > > > 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.Sorry for not setting context here. These variables are all local variables, is there a need to create a relocation ? Thanks Shankar Easwaran -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130923/0122c7e7/attachment.html>