bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/31752] gas: Support \+ in .rept/.irp/.irpc directives


From: i at maskray dot me
Subject: [Bug gas/31752] gas: Support \+ in .rept/.irp/.irpc directives
Date: Fri, 17 May 2024 18:07:32 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=31752

--- Comment #1 from Fangrui Song <i at maskray dot me> ---
In the absence of the feature, there are a few ways, but none achieves great
efficiency or convenience.

For example, we can define a macro that expands to a sequence of strings: 0,
(0+1), ((0+1)+1), (((0+1)+1)+1), ...

% cat a.s
.data
.macro iota n, i=0
.if \n-\i
.byte \i
iota \n, "(\i+1)"
.endif
.endm

iota 16
% as a.s -o a.o
% readelf -x .data a.o

Hex dump of section '.data':
  0x00000000 00010203 04050607 08090a0b 0c0d0e0f ................

---

% in altmacro allows:

% cat a.s
.data
.altmacro
.macro iota n, i=0
.if \n-\i
.byte \i
iota \n, %(\i+1)
.endif
.endm

iota 16
% as a.s -o a.o
% readelf -x .data a.o

Hex dump of section '.data':
  0x00000000 00010203 04050607 08090a0b 0c0d0e0f ................

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]