diff options
author | Lifang Xia <lifang_xia@c-sky.com> | 2018-09-14 21:02:51 +0800 |
---|---|---|
committer | Lifang Xia <lifang_xia@c-sky.com> | 2018-09-14 21:04:47 +0800 |
commit | fe75f42ee15944a0d14d3d42b242676fc2417352 (patch) | |
tree | 3b2767935fe63bc1c6585bbc3a394ebab6eb34d7 /gas/config | |
parent | 87b240d48512fa30aab8b5963914a9093009fd68 (diff) | |
download | gdb-fe75f42ee15944a0d14d3d42b242676fc2417352.zip gdb-fe75f42ee15944a0d14d3d42b242676fc2417352.tar.gz gdb-fe75f42ee15944a0d14d3d42b242676fc2417352.tar.bz2 |
csky: Support PC relative diff relocation
Define DIFF_EXPR_OK to Support PC relative diff relocation,
and add CKCORE_PCREL32 relocation process
bfd/
* elf32-csky.c (csky_elf_howto_table): Fill special_function of
R_CKCORE_PCREL32.
(csky_elf_relocate_section): Add R_CKCORE_PCREL32 process.
gas/
* config/tc-csky.c (md_apply_fix): Transmit
BFD_RELOC_32_PCREL to BFD_RELOC_CKCORE_PCREL32.
(tc_gen_reloc): Trasmit BFD_RELOC_CKCORE_ADDR32 to
BFD_RELOC_CKCORE_PCREL32 while pc-relative.
* config/tc-csky.h (DIFF_EXPR_OK): Define to enable PC relative
diff relocs.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-csky.c | 6 | ||||
-rw-r--r-- | gas/config/tc-csky.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c index bd0672f..1c4b44b 100644 --- a/gas/config/tc-csky.c +++ b/gas/config/tc-csky.c @@ -4920,7 +4920,9 @@ md_apply_fix (fixS *fixP, /* We can handle these relocs. */ switch (fixP->fx_r_type) { + case BFD_RELOC_32_PCREL: case BFD_RELOC_CKCORE_PCREL32: + fixP->fx_r_type = BFD_RELOC_CKCORE_PCREL32; break; case BFD_RELOC_VTABLE_INHERIT: fixP->fx_r_type = BFD_RELOC_CKCORE_GNU_VTINHERIT; @@ -5133,6 +5135,10 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) { arelent *rel; + if (fixP->fx_pcrel + && fixP->fx_r_type == BFD_RELOC_CKCORE_ADDR32) + fixP->fx_r_type = BFD_RELOC_CKCORE_PCREL32; + rel = xmalloc (sizeof (arelent)); rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); *rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h index 4ea0c03..bb70ca2 100644 --- a/gas/config/tc-csky.h +++ b/gas/config/tc-csky.h @@ -62,6 +62,9 @@ #define DWARF2_DEFAULT_RETURN_COLUMN 15 #define DWARF2_CIE_DATA_ALIGNMENT (-4) +/* .-foo gets turned into PC relative relocs. */ +#define DIFF_EXPR_OK 1 + typedef enum { MAP_UNDEFINED = 0, |