aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-arm.c27
-rw-r--r--gas/testsuite/gas/arm/reloc-fdpic.d20
-rw-r--r--gas/testsuite/gas/arm/reloc-fdpic.s9
4 files changed, 65 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5db76c9..122daaa 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,16 @@
2018-04-25 Christophe Lyon <christophe.lyon@st.com>
Mickaël Guêné <mickael.guene@st.com>
+ * config/tc-arm.c (reloc_names): Add gotfuncdesc, gotofffuncdesc,
+ funcdesc.
+ (md_apply_fix): Support the new relocations.
+ (tc_gen_reloc): Likewise.
+ * testsuite/gas/arm/reloc-fdpic.d: New.
+ * testsuite/gas/arm/reloc-fdpic.s: New.
+
+2018-04-25 Christophe Lyon <christophe.lyon@st.com>
+ Mickaël Guêné <mickael.guene@st.com>
+
* config/tc-arm.c (arm_fdpic): New.
(elf32_arm_target_format): Support FDPIC.
(OPTION_FDPIC): New.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index d735609..33a88bb 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -19303,7 +19303,13 @@ static struct reloc_entry reloc_names[] =
{ "tlscall", BFD_RELOC_ARM_TLS_CALL},
{ "TLSCALL", BFD_RELOC_ARM_TLS_CALL},
{ "tlsdescseq", BFD_RELOC_ARM_TLS_DESCSEQ},
- { "TLSDESCSEQ", BFD_RELOC_ARM_TLS_DESCSEQ}
+ { "TLSDESCSEQ", BFD_RELOC_ARM_TLS_DESCSEQ},
+ { "gotfuncdesc", BFD_RELOC_ARM_GOTFUNCDESC },
+ { "GOTFUNCDESC", BFD_RELOC_ARM_GOTFUNCDESC },
+ { "gotofffuncdesc", BFD_RELOC_ARM_GOTOFFFUNCDESC },
+ { "GOTOFFFUNCDESC", BFD_RELOC_ARM_GOTOFFFUNCDESC },
+ { "funcdesc", BFD_RELOC_ARM_FUNCDESC },
+ { "FUNCDESC", BFD_RELOC_ARM_FUNCDESC }
};
#endif
@@ -23992,6 +23998,22 @@ md_apply_fix (fixS * fixP,
if (fixP->fx_done || !seg->use_rela_p)
md_number_to_chars (buf, fixP->fx_offset, 4);
break;
+
+ /* Relocations for FDPIC. */
+ case BFD_RELOC_ARM_GOTFUNCDESC:
+ case BFD_RELOC_ARM_GOTOFFFUNCDESC:
+ case BFD_RELOC_ARM_FUNCDESC:
+ if (arm_fdpic)
+ {
+ if (fixP->fx_done || !seg->use_rela_p)
+ md_number_to_chars (buf, 0, 4);
+ }
+ else
+ {
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("Relocation supported only in FDPIC mode"));
+ }
+ break;
#endif
case BFD_RELOC_RVA:
@@ -24753,6 +24775,9 @@ tc_gen_reloc (asection *section, fixS *fixp)
case BFD_RELOC_ARM_THUMB_ALU_ABS_G1_NC:
case BFD_RELOC_ARM_THUMB_ALU_ABS_G2_NC:
case BFD_RELOC_ARM_THUMB_ALU_ABS_G3_NC:
+ case BFD_RELOC_ARM_GOTFUNCDESC:
+ case BFD_RELOC_ARM_GOTOFFFUNCDESC:
+ case BFD_RELOC_ARM_FUNCDESC:
code = fixp->fx_r_type;
break;
diff --git a/gas/testsuite/gas/arm/reloc-fdpic.d b/gas/testsuite/gas/arm/reloc-fdpic.d
new file mode 100644
index 0000000..c25aa80
--- /dev/null
+++ b/gas/testsuite/gas/arm/reloc-fdpic.d
@@ -0,0 +1,20 @@
+#as: --fdpic
+#objdump: -dr --show-raw-insn
+#name: FDPIC relocations
+# This test is only valid on ELF based ports.
+#not-skip: arm*-*-uclinuxfdpiceabi
+
+.*: +file format .*arm.*
+
+
+Disassembly of section .text:
+
+00000000 <myfunc-0xc>:
+.*
+ 0: R_ARM_GOTFUNCDESC myfunc
+ 4: R_ARM_GOTOFFFUNCDESC myfunc
+ 8: R_ARM_FUNCDESC myfunc
+
+0000000c <myfunc>:
+ c: e12fff1e bx lr
+.* \ No newline at end of file
diff --git a/gas/testsuite/gas/arm/reloc-fdpic.s b/gas/testsuite/gas/arm/reloc-fdpic.s
new file mode 100644
index 0000000..cbb61c5
--- /dev/null
+++ b/gas/testsuite/gas/arm/reloc-fdpic.s
@@ -0,0 +1,9 @@
+ .syntax unified
+
+ .word myfunc(GOTFUNCDESC)
+ .word myfunc(GOTOFFFUNCDESC)
+ .word myfunc(FUNCDESC)
+
+ .type myfunc, %function
+myfunc:
+ bx lr