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

SRINATH PARVATHANENI <srinath.parvathaneni at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |srinath.parvathaneni at arm 
dot co
                   |                            |m

--- Comment #1 from SRINATH PARVATHANENI <srinath.parvathaneni at arm dot com> 
---
I believe the ICE is caused by the `%dtprel(...)` handling in
`gas/config/tc-aarch64.c:s_aarch64_cons()`:

```c
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);
```

The DTPREL fixup is created before the storage for the `.xword` is reserved.

With some instrumentation, the failing case shows:

```text
where = 3921
size  = 8
fr_fix = 3921
loc   = 3929 (where + size)
```

Later, in `write_relocs()`, the following check triggers:

```c
if (slack >= 0 && loc > fixp->fx_frag->fr_fix)
  as_bad_where (fixp->fx_file, fixp->fx_line,
                _("internal error: fixup not contained within frag"));
```

Since `loc` (3929) is greater than `fr_fix` (3921), GAS reports:

```text
internal error: fixup not contained within frag
```

Locally, changing the ordering so that the storage is reserved before creating
the fixup appears to avoid the ICE.

I was not able to produce a small standalone reproducer. The failure seems to
depend on the particular DWARF layout: not every `%dtprel` relocation triggers
it. In this case, the DTPREL fixup is created at a frag boundary, which appears
to expose this corner case.

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

Reply via email to