Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

x86 integrated assembler: .altmacro string replacement not performed in .irp macro use #37971

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR38999
Status NEW
Importance P enhancement
Reported by emaste@freebsd.org
Reported on 2018-09-19 08:29:21 -0700
Last modified on 2020-11-04 12:07:17 -0800
Version 5.0
Hardware PC FreeBSD
CC cem@FreeBSD.org, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also PR33405
Found while trying to build the FreeBSD base system entirely with the
integrated assembler.

One of .altmacro's effects is:

Expression results as strings
    You can write `%expr' to evaluate the expression expr and use the result as a string.

Consider the following snippet:

------------------------
.altmacro

.macro m dst,src
  addq %\src,%\dst
.endm

.irp r,r15
  m r,r8
.endr
------------------------

GNU as and gcc assemble this, while Clang (6.0) IAS produces:

<instantiation>:1:10: error: invalid register name
addq %r8,%r
         ^~
<instantiation>:1:1: note: while in macro instantiation
m r,r8
^
macro.s:7:1: note: while in macro instantiation
.irp r,r15
^
Quuxplusone commented 3 years ago

Still cannot be assembled with Clang IAS and can with GCC and GNU as, but we have worked around the issue in the base system.