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