aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIain Sandoe <iain@codesourcery.com>2012-02-17 10:57:33 +0000
committerIain Sandoe <iain@codesourcery.com>2012-02-17 10:57:33 +0000
commite1e81ed3c319f765df8a755a6b901df650a4e4a0 (patch)
treeffa1e950641420fc19abb0587860bd53b9ea1d29 /bfd
parentca193e277905cd464dfd5cf1b8391017a7a861ec (diff)
downloadgdb-e1e81ed3c319f765df8a755a6b901df650a4e4a0.zip
gdb-e1e81ed3c319f765df8a755a6b901df650a4e4a0.tar.gz
gdb-e1e81ed3c319f765df8a755a6b901df650a4e4a0.tar.bz2
add LOCAL SECDIFF relocation for m32 mach-o
bfd: * reloc.c (BFD_RELOC_MACH_O_LOCAL_SECTDIFF): * libbfd.h: Regenerated. * bfd-in2.h: Likewise. * mach-o-i386.c (i386_howto_table): Include local sectdiff. (bfd_mach_o_i386_swap_reloc_in): Update for local sectdiff. (bfd_mach_o_i386_swap_reloc_out): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/bfd-in2.h4
-rw-r--r--bfd/libbfd.h1
-rw-r--r--bfd/mach-o-i386.c23
-rw-r--r--bfd/reloc.c4
5 files changed, 39 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ceed759..b5b8a4b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2012-02-17 Tristan Gingold <gingold@adacore.com>
+
+ * reloc.c (BFD_RELOC_MACH_O_LOCAL_SECTDIFF):
+ * libbfd.h: Regenerated.
+ * bfd-in2.h: Likewise.
+ * mach-o-i386.c (i386_howto_table): Include local sectdiff.
+ (bfd_mach_o_i386_swap_reloc_in): Update for local sectdiff.
+ (bfd_mach_o_i386_swap_reloc_out): Likewise.
+
2012-02-17 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* elf32-s390.c (elf_s390_relocate_section): Support basr in the
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 5072e43..fb56337 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2161,6 +2161,7 @@ enum bfd_architecture
#define bfd_mach_tilegx 1
bfd_arch_last
};
+
typedef struct bfd_arch_info
{
int bits_per_word;
@@ -4824,6 +4825,9 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */
BFD_RELOC_MACH_O_PAIR. */
BFD_RELOC_MACH_O_SECTDIFF,
+/* Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol. */
+ BFD_RELOC_MACH_O_LOCAL_SECTDIFF,
+
/* Pair of relocation. Contains the first symbol. */
BFD_RELOC_MACH_O_PAIR,
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 19c96cb..62f128f 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -2337,6 +2337,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_LM32_JMP_SLOT",
"BFD_RELOC_LM32_RELATIVE",
"BFD_RELOC_MACH_O_SECTDIFF",
+ "BFD_RELOC_MACH_O_LOCAL_SECTDIFF",
"BFD_RELOC_MACH_O_PAIR",
"BFD_RELOC_MACH_O_X86_64_BRANCH32",
"BFD_RELOC_MACH_O_X86_64_BRANCH8",
diff --git a/bfd/mach-o-i386.c b/bfd/mach-o-i386.c
index 71272eb..b681352 100644
--- a/bfd/mach-o-i386.c
+++ b/bfd/mach-o-i386.c
@@ -63,6 +63,7 @@ bfd_mach_o_i386_mkobject (bfd *abfd)
static reloc_howto_type i386_howto_table[]=
{
+ /* 0 */
HOWTO(BFD_RELOC_32, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
NULL, "32",
@@ -79,6 +80,7 @@ static reloc_howto_type i386_howto_table[]=
complain_overflow_bitfield,
NULL, "DISP32",
FALSE, 0xffffffff, 0xffffffff, TRUE),
+ /* 4 */
HOWTO(BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0,
complain_overflow_bitfield,
NULL, "DISP16",
@@ -87,6 +89,10 @@ static reloc_howto_type i386_howto_table[]=
complain_overflow_bitfield,
NULL, "SECTDIFF_32",
FALSE, 0xffffffff, 0xffffffff, FALSE),
+ HOWTO(BFD_RELOC_MACH_O_LOCAL_SECTDIFF, 0, 2, 32, FALSE, 0,
+ complain_overflow_bitfield,
+ NULL, "LSECTDIFF_32",
+ FALSE, 0xffffffff, 0xffffffff, FALSE),
HOWTO(BFD_RELOC_MACH_O_PAIR, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield,
NULL, "PAIR_32",
@@ -103,15 +109,19 @@ bfd_mach_o_i386_swap_reloc_in (arelent *res, bfd_mach_o_reloc_info *reloc)
case BFD_MACH_O_GENERIC_RELOC_PAIR:
if (reloc->r_length != 2)
return FALSE;
- res->howto = &i386_howto_table[6];
+ res->howto = &i386_howto_table[7];
res->address = res[-1].address;
return TRUE;
case BFD_MACH_O_GENERIC_RELOC_SECTDIFF:
- case BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF:
if (reloc->r_length != 2)
return FALSE;
res->howto = &i386_howto_table[5];
return TRUE;
+ case BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF:
+ if (reloc->r_length != 2)
+ return FALSE;
+ res->howto = &i386_howto_table[6];
+ return TRUE;
default:
return FALSE;
}
@@ -183,6 +193,15 @@ bfd_mach_o_i386_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
rinfo->r_value = (*rel->sym_ptr_ptr)->value
+ (*rel->sym_ptr_ptr)->section->vma;
break;
+ case BFD_RELOC_MACH_O_LOCAL_SECTDIFF:
+ rinfo->r_scattered = 1;
+ rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF;
+ rinfo->r_pcrel = 0;
+ rinfo->r_length = 2;
+ rinfo->r_extern = 0;
+ rinfo->r_value = (*rel->sym_ptr_ptr)->value
+ + (*rel->sym_ptr_ptr)->section->vma;
+ break;
case BFD_RELOC_MACH_O_PAIR:
rinfo->r_address = 0;
rinfo->r_scattered = 1;
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 5cde4a8..778276f 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -5594,6 +5594,10 @@ ENUMDOC
Difference between two section addreses. Must be followed by a
BFD_RELOC_MACH_O_PAIR.
ENUM
+ BFD_RELOC_MACH_O_LOCAL_SECTDIFF
+ENUMDOC
+ Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol.
+ENUM
BFD_RELOC_MACH_O_PAIR
ENUMDOC
Pair of relocation. Contains the first symbol.