aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMephi <mephi42@gmail.com>2018-06-18 12:56:44 +0100
committerNick Clifton <nickc@redhat.com>2018-06-18 12:56:44 +0100
commited1299fe460812ad4bbdc2192d0c0cbeba3d6b66 (patch)
tree17c4f6b7e37957989ec1caf0b230c4a44d8a0e42 /bfd
parent02895270ec7243f46ea3e84dc385515533dc0139 (diff)
downloadgdb-ed1299fe460812ad4bbdc2192d0c0cbeba3d6b66.zip
gdb-ed1299fe460812ad4bbdc2192d0c0cbeba3d6b66.tar.gz
gdb-ed1299fe460812ad4bbdc2192d0c0cbeba3d6b66.tar.bz2
Add support for the TLV relocation generated by LLVM for x86_64 MACH-O targets.
PR 23297 * mach-o-x86-64.c (x86_64_howto_table): Add entry for BFD_RELOC_MACH_O_X86_64_RELOC_TLV. (bfd_mach_o_x86_64_canonicalize_one_reloc): Handle the new reloc. (bfd_mach_o_x86_64_swap_reloc_out): Likewise. * reloc.c (BFD_RELOC_MACH_O_X86_64_TV): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/bfd-in2.h3
-rw-r--r--bfd/libbfd.h1
-rw-r--r--bfd/mach-o-x86-64.c17
-rw-r--r--bfd/reloc.c4
5 files changed, 36 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b14eea6..356c7d2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,14 @@
+2018-06-18 Mephi <mephi42@gmail.com>
+
+ PR 23297
+ * mach-o-x86-64.c (x86_64_howto_table): Add entry for
+ BFD_RELOC_MACH_O_X86_64_RELOC_TLV.
+ (bfd_mach_o_x86_64_canonicalize_one_reloc): Handle the new reloc.
+ (bfd_mach_o_x86_64_swap_reloc_out): Likewise.
+ * reloc.c (BFD_RELOC_MACH_O_X86_64_TV): New entry.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
2018-06-14 Faraz Shahbazker <Faraz.Shahbazker@mips.com>
* elfxx-mips.c (print_mips_ases): Add GINV extension.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 5ceb935..f53dbb5 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -5755,6 +5755,9 @@ the linker could optimize the movq to a leaq if possible. */
/* Same as BFD_RELOC_32_PCREL but with an implicit -4 addend. */
BFD_RELOC_MACH_O_X86_64_PCREL32_4,
+/* Used when referencing a TLV entry. */
+ BFD_RELOC_MACH_O_X86_64_TLV,
+
/* Addend for PAGE or PAGEOFF. */
BFD_RELOC_MACH_O_ARM64_ADDEND,
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 12b1a96..85f61b2 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2852,6 +2852,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MACH_O_X86_64_PCREL32_1",
"BFD_RELOC_MACH_O_X86_64_PCREL32_2",
"BFD_RELOC_MACH_O_X86_64_PCREL32_4",
+ "BFD_RELOC_MACH_O_X86_64_TLV",
"BFD_RELOC_MACH_O_ARM64_ADDEND",
"BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGE21",
"BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12",
diff --git a/bfd/mach-o-x86-64.c b/bfd/mach-o-x86-64.c
index 667c1d0..9ee93a4 100644
--- a/bfd/mach-o-x86-64.c
+++ b/bfd/mach-o-x86-64.c
@@ -117,6 +117,11 @@ static reloc_howto_type x86_64_howto_table[]=
complain_overflow_bitfield,
NULL, "BRANCH8",
FALSE, 0xff, 0xff, TRUE),
+ /* 12 */
+ HOWTO(BFD_RELOC_MACH_O_X86_64_TLV, 0, 2, 32, TRUE, 0,
+ complain_overflow_bitfield,
+ NULL, "TLV",
+ FALSE, 0xffffffff, 0xffffffff, TRUE),
};
static bfd_boolean
@@ -220,6 +225,13 @@ bfd_mach_o_x86_64_canonicalize_one_reloc (bfd * abfd,
return TRUE;
}
break;
+ case BFD_MACH_O_X86_64_RELOC_TLV:
+ if (reloc.r_length == 2 && reloc.r_pcrel && reloc.r_extern)
+ {
+ res->howto = &x86_64_howto_table[12];
+ return TRUE;
+ }
+ break;
default:
return FALSE;
}
@@ -288,6 +300,11 @@ bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
rinfo->r_pcrel = 1;
rinfo->r_length = 2;
break;
+ case BFD_RELOC_MACH_O_X86_64_TLV:
+ rinfo->r_type = BFD_MACH_O_X86_64_RELOC_TLV;
+ rinfo->r_pcrel = 1;
+ rinfo->r_length = 2;
+ break;
default:
return FALSE;
}
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 411f998..68bc8a8 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -6816,6 +6816,10 @@ ENUM
BFD_RELOC_MACH_O_X86_64_PCREL32_4
ENUMDOC
Same as BFD_RELOC_32_PCREL but with an implicit -4 addend.
+ENUM
+ BFD_RELOC_MACH_O_X86_64_TLV
+ENUMDOC
+ Used when referencing a TLV entry.
ENUM