From 6f4a117fe1ea8f5722ff9fd4db9a1ecc8bd26b84 Mon Sep 17 00:00:00 2001 From: Mark Harmstone Date: Mon, 23 Jan 2023 00:26:07 +0000 Subject: Add support for secidx relocations to aarch64-w64-mingw32 This patch adds support for the .secidx directive and its corresponding relocation to aarch64-w64-mingw32. As with x86, this is a two-byte LE integer which gets filled in with the 1-based index of the output section that a symbol ends up in. This is needed for PDBs, which represent addresses as a .secrel32, .secidx pair. The test is substantially the same as for amd64, but with changes made for padding and alignment. --- gas/config/tc-aarch64.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gas') diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 2b74db2..2aeab6f 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -2127,6 +2127,25 @@ tc_pe_dwarf2_emit_offset (symbolS *symbol, unsigned int size) exp.X_add_number = 0; emit_expr (&exp, size); } + +static void +s_secidx (int dummy ATTRIBUTE_UNUSED) +{ + expressionS exp; + + do + { + expression (&exp); + if (exp.X_op == O_symbol) + exp.X_op = O_secidx; + + emit_expr (&exp, 2); + } + while (*input_line_pointer++ == ','); + + input_line_pointer--; + demand_empty_rest_of_line (); +} #endif /* TE_PE */ static void s_aarch64_arch (int); @@ -2166,6 +2185,7 @@ const pseudo_typeS md_pseudo_table[] = { #endif #ifdef TE_PE {"secrel32", s_secrel, 0}, + {"secidx", s_secidx, 0}, #endif {"float16", float_cons, 'h'}, {"bfloat16", float_cons, 'b'}, @@ -9304,6 +9324,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg) case BFD_RELOC_RVA: case BFD_RELOC_32_SECREL: + case BFD_RELOC_16_SECIDX: break; default: @@ -9395,6 +9416,11 @@ cons_fix_new_aarch64 (fragS * frag, int where, int size, expressionS * exp) exp->X_op = O_symbol; type = BFD_RELOC_32_SECREL; } + else if (exp->X_op == O_secidx) + { + exp->X_op = O_symbol; + type = BFD_RELOC_16_SECIDX; + } else { #endif -- cgit v1.1