From d71893802fe424e3123ced8c6ed158958487f716 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 22 May 2021 12:59:36 +0930 Subject: [PATCH] Re: Fix offset for ia64 PCREL60B relocation on HP-UX PR 25599 * config/tc-ia64.c (emit_one_bundle): Expand comment for HP-UX adjustment. Add assertion. * testsuite/gas/ia64/reloc-mlx.d: Pass when slot 2 specified for PCREL60B. --- gas/ChangeLog | 8 ++++++++ gas/config/tc-ia64.c | 10 ++++++++-- gas/testsuite/gas/ia64/reloc-mlx.d | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index b9a59b66b80..cf135d98d51 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2021-05-22 Alan Modra + + PR 25599 + * config/tc-ia64.c (emit_one_bundle): Expand comment for HP-UX + adjustment. Add assertion. + * testsuite/gas/ia64/reloc-mlx.d: Pass when slot 2 specified + for PCREL60B. + 2021-05-20 Sergey Belyashov * config/tc-z80.c (emit_data_val): Warn on constant overflow. diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 34482eb4f97..dd2147b5176 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -6892,9 +6892,15 @@ emit_one_bundle (void) ifix = md.slot[curr].fixup + j; where = frag_now_fix () - 16 + i; #ifdef TE_HPUX - /* Fix offset for PCREL60B relocation on HP-UX. */ + /* Relocations for instructions specify the slot in the + bottom two bits of r_offset. The IA64 HP-UX linker + expects PCREL60B relocations to specify slot 2 of an + instruction. gas generates PCREL60B against slot 1. */ if (ifix->code == BFD_RELOC_IA64_PCREL60B) - ++where; + { + know (i == 1); + ++where; + } #endif fix = fix_new_exp (frag_now, where, 8, diff --git a/gas/testsuite/gas/ia64/reloc-mlx.d b/gas/testsuite/gas/ia64/reloc-mlx.d index cd210f6f005..1583872481d 100644 --- a/gas/testsuite/gas/ia64/reloc-mlx.d +++ b/gas/testsuite/gas/ia64/reloc-mlx.d @@ -5,4 +5,4 @@ RELOCATION RECORDS FOR \[\.text\]: OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]* -0+1[[:space:]]+PCREL60B[[:space:]]+bar +0+[12][[:space:]]+PCREL60B[[:space:]]+bar -- 2.30.2