[PATCH v1] aarch64: Fix assembler internal error for %dtprel relocations
srinath.parvathaneni@arm.com
srinath.parvathaneni@arm.com
Mon Jul 6 09:47:28 GMT 2026
From: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
The current implementation creates the DTPREL fixup before reserving
the storage for the corresponding ".xword". GCC's "%dtprel" support
for TLS DWARF debug information exposed this during an AArch64 bootstrap,
where the libsanitizer/tsan DWARF layout places the DTPREL fixup at a
frag boundary. Reserving the storage before creating the fixup avoids
this corner case.
The simplest reproducer (tsan_interceptors_posix-bad.s from libsanitizer/tsan)
is 50k lines and I'm avoid attaching that hugh testfile to this patch.
gas/
PR binutils/34357
* config/tc-aarch64.c (s_aarch64_cons) : Fix the storage order for
DTPREL.
Regression tested on aarch64-linux-gnu and found no regressions.
Ok for master?
Regards,
Srinath
---
gas/config/tc-aarch64.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 715df4de4bf..2da5139d8af 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -2244,15 +2244,13 @@ s_aarch64_cons (int nbytes)
return;
}
- addressT where = frag_now_fix ();
- fix_new_exp (frag_now, where, nbytes, &exp, 0,
- BFD_RELOC_AARCH64_TLS_DTPREL);
-
char *dest = frag_more (nbytes);
memset (dest, 0, nbytes);
+
+ fix_new_exp (frag_now, dest - frag_now->fr_literal, nbytes,
+ &exp, 0, BFD_RELOC_AARCH64_TLS_DTPREL);
continue;
}
-
else
{
as_bad (_("unknown relocation operator"));
--
2.43.0
More information about the Binutils
mailing list