aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMark Harmstone <mark@harmstone.com>2022-12-15 23:24:09 +0000
committerMark Harmstone <mark@harmstone.com>2023-01-10 23:30:46 +0000
commit528e4f463f511b11ad414bc91bcf89c4fb53c352 (patch)
tree16e97352b06f33fa21d6d63305c91c600c2ea3d5 /gas
parentb152649d51b52e4e82176fb835b8b91a9ca08ad4 (diff)
downloadgdb-528e4f463f511b11ad414bc91bcf89c4fb53c352.zip
gdb-528e4f463f511b11ad414bc91bcf89c4fb53c352.tar.gz
gdb-528e4f463f511b11ad414bc91bcf89c4fb53c352.tar.bz2
Add .secrel32 for pe-aarch64
Adds the .secrel32 pseudo-directive and its corresponding relocation.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-aarch64.c75
-rw-r--r--gas/config/tc-aarch64.h4
2 files changed, 60 insertions, 19 deletions
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 25e7943..ad070cd 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -2097,6 +2097,27 @@ s_tlsdescldr (int ignored ATTRIBUTE_UNUSED)
}
#endif /* OBJ_ELF */
+#ifdef TE_PE
+static void
+s_secrel (int dummy ATTRIBUTE_UNUSED)
+{
+ expressionS exp;
+
+ do
+ {
+ expression (&exp);
+ if (exp.X_op == O_symbol)
+ exp.X_op = O_secrel;
+
+ emit_expr (&exp, 4);
+ }
+ while (*input_line_pointer++ == ',');
+
+ input_line_pointer--;
+ demand_empty_rest_of_line ();
+}
+#endif /* TE_PE */
+
static void s_aarch64_arch (int);
static void s_aarch64_cpu (int);
static void s_aarch64_arch_extension (int);
@@ -2132,6 +2153,9 @@ const pseudo_typeS md_pseudo_table[] = {
{"xword", s_aarch64_cons, 8},
{"dword", s_aarch64_cons, 8},
#endif
+#ifdef TE_PE
+ {"secrel32", s_secrel, 0},
+#endif
{"float16", float_cons, 'h'},
{"bfloat16", float_cons, 'b'},
{0, 0, 0}
@@ -9268,6 +9292,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
break;
case BFD_RELOC_RVA:
+ case BFD_RELOC_32_SECREL:
break;
default:
@@ -9353,27 +9378,39 @@ cons_fix_new_aarch64 (fragS * frag, int where, int size, expressionS * exp)
bfd_reloc_code_real_type type;
int pcrel = 0;
- /* Pick a reloc.
- FIXME: @@ Should look at CPU word size. */
- switch (size)
+#ifdef TE_PE
+ if (exp->X_op == O_secrel)
{
- case 1:
- type = BFD_RELOC_8;
- break;
- case 2:
- type = BFD_RELOC_16;
- break;
- case 4:
- type = BFD_RELOC_32;
- break;
- case 8:
- type = BFD_RELOC_64;
- break;
- default:
- as_bad (_("cannot do %u-byte relocation"), size);
- type = BFD_RELOC_UNUSED;
- break;
+ exp->X_op = O_symbol;
+ type = BFD_RELOC_32_SECREL;
}
+ else
+ {
+#endif
+ /* Pick a reloc.
+ FIXME: @@ Should look at CPU word size. */
+ switch (size)
+ {
+ case 1:
+ type = BFD_RELOC_8;
+ break;
+ case 2:
+ type = BFD_RELOC_16;
+ break;
+ case 4:
+ type = BFD_RELOC_32;
+ break;
+ case 8:
+ type = BFD_RELOC_64;
+ break;
+ default:
+ as_bad (_("cannot do %u-byte relocation"), size);
+ type = BFD_RELOC_UNUSED;
+ break;
+ }
+#ifdef TE_PE
+ }
+#endif
fix_new_exp (frag, where, (int) size, exp, pcrel, type);
}
diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index d7d782c..fa4b3ac 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -314,4 +314,8 @@ extern void aarch64_handle_align (struct frag *);
extern int tc_aarch64_regname_to_dw2regnum (char *regname);
extern void tc_aarch64_frame_initial_instructions (void);
+#ifdef TE_PE
+#define O_secrel O_md1
+#endif /* TE_PE */
+
#endif /* TC_AARCH64 */