[LLVMdev] Case sensitive .macros for llvm-mc and arithmetic in expressions

Sid Manning sidneym at codeaurora.org
Thu Aug 1 07:15:01 PDT 2013


I have come across some assembly that assumes macro names are not case 
sensitive.  My first reaction is to have the user fix the code until I 
found out that gas .macro names are not case sensitive.

While this isn't the exact code, it is representative of the problem:
#---
              .macro  sUm from=0, to=5
              .long   \from
              .if     \to-\from
              sum     "(\from+1)",\to
              .endif
              .endm

sum 0, 5
#---
Results in the following error:
   sum.s:9:1: error: invalid operand for instruction
   sum 0, 5

I have attached a patch that might be all that is needed to fix case 
sensitivity.

In another case there is an expression like this:
#---
.Ltmp1:
.long 0xdeadbeef
.Ltmp7:
.long 0xdeadbeef
.Ltmp22:
	.long	(.Ltmp7-.Ltmp1) - .Ltmp22
#---
The above results in this error:
   LLVM ERROR: expected relocatable expression

The above seems like it should work, and if .Ltmp22 is replaced by a 
number it does.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macro.diff
Type: text/x-patch
Size: 894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130801/49cf400a/attachment.bin>


More information about the llvm-dev mailing list