aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/coff-i386.c208
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/i386/i386.exp4
-rw-r--r--gas/testsuite/gas/i386/reloc.d10
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-shared/shared.exp1
7 files changed, 132 insertions, 107 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6c07ea2..503f159 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+1999-09-17 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * coff-i386.c (coff_i386_reloc_type_lookup): Support BFD_RELOC_16,
+ BFD_RELOC_16_PCREL, BFD_RELOC_8, BFD_RELOC_8_PCREL relocs.
+ (reloc_howto_type howto_table): Tidy comments and whitespace.
+
1999-09-17 Nick Clifton <nickc@cygnus.com>
* elf32-arm.h (bfd_elf32_arm_get_bfd_for_interworking): Undo
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index f7eb1f5..a463e58 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "libcoff.h"
-static bfd_reloc_status_type coff_i386_reloc
+static bfd_reloc_status_type coff_i386_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static reloc_howto_type *coff_i386_rtype_to_howto
PARAMS ((bfd *, asection *, struct internal_reloc *,
@@ -167,7 +167,7 @@ static boolean in_reloc_p (abfd, howto)
reloc_howto_type *howto;
{
return ! howto->pc_relative && howto->type != R_IMAGEBASE;
-}
+}
#endif /* COFF_WITH_PE */
@@ -175,7 +175,7 @@ static boolean in_reloc_p (abfd, howto)
#define PCRELOFFSET false
#endif
-static reloc_howto_type howto_table[] =
+static reloc_howto_type howto_table[] =
{
EMPTY_HOWTO (0),
EMPTY_HOWTO (1),
@@ -183,33 +183,33 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (3),
EMPTY_HOWTO (4),
EMPTY_HOWTO (5),
- HOWTO (R_DIR32, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_DIR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "dir32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- true), /* pcrel_offset */
- /* PE IMAGE_REL_I386_DIR32NB relocation (7). */
- HOWTO (R_IMAGEBASE, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ coff_i386_reloc, /* special_function */
+ "dir32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+ /* PE IMAGE_REL_I386_DIR32NB relocation (7). */
+ HOWTO (R_IMAGEBASE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "rva32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
- false), /* pcrel_offset */
+ coff_i386_reloc, /* special_function */
+ "rva32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
@@ -219,87 +219,87 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (016),
/* Byte relocation (017). */
HOWTO (R_RELBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "8", /* name */
- true, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "8", /* name */
+ true, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 16-bit word relocation (020). */
- HOWTO (R_RELWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_RELWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "16", /* name */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- /* 32-bit longword relocation (021). */
- HOWTO (R_RELLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- false, /* pc_relative */
- 0, /* bitpos */
+ /* 32-bit longword relocation (021). */
+ HOWTO (R_RELLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- /* Byte PC relative relocation (022). */
- HOWTO (R_PCRBYTE, /* type */
- 0, /* rightshift */
- 0, /* size (0 = byte, 1 = short, 2 = long) */
- 8, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ /* Byte PC relative relocation (022). */
+ HOWTO (R_PCRBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP8", /* name */
- true, /* partial_inplace */
- 0x000000ff, /* src_mask */
- 0x000000ff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "DISP8", /* name */
+ true, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
- /* 16-bit word PC relative relocation (023). */
- HOWTO (R_PCRWORD, /* type */
- 0, /* rightshift */
- 1, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ /* 16-bit word PC relative relocation (023). */
+ HOWTO (R_PCRWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP16", /* name */
- true, /* partial_inplace */
- 0x0000ffff, /* src_mask */
- 0x0000ffff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "DISP16", /* name */
+ true, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 32-bit longword PC relative relocation (024). */
- HOWTO (R_PCRLONG, /* type */
- 0, /* rightshift */
- 2, /* size (0 = byte, 1 = short, 2 = long) */
- 32, /* bitsize */
- true, /* pc_relative */
- 0, /* bitpos */
+ HOWTO (R_PCRLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
- coff_i386_reloc, /* special_function */
- "DISP32", /* name */
- true, /* partial_inplace */
- 0xffffffff, /* src_mask */
- 0xffffffff, /* dst_mask */
+ coff_i386_reloc, /* special_function */
+ "DISP32", /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
};
@@ -432,7 +432,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
function will be adding in the final value of the symbol. We
need to subtract out the current size in order to get the
correct result. */
-
+
BFD_ASSERT (h != NULL);
#ifndef COFF_WITH_PE
@@ -451,7 +451,7 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
/* If the output symbol is common (in which case this must be a
relocateable link), we need to add in the final size of the
common symbol. */
- if (h != NULL && h->root.type == bfd_link_hash_common)
+ if (h != NULL && h->root.type == bfd_link_hash_common)
*addendp += h->root.u.c.size;
#endif
@@ -489,11 +489,19 @@ coff_i386_reloc_type_lookup (abfd, code)
switch (code)
{
case BFD_RELOC_RVA:
- return howto_table +R_IMAGEBASE;
+ return howto_table + R_IMAGEBASE;
case BFD_RELOC_32:
return howto_table + R_DIR32;
case BFD_RELOC_32_PCREL:
return howto_table + R_PCRLONG;
+ case BFD_RELOC_16:
+ return howto_table + R_RELWORD;
+ case BFD_RELOC_16_PCREL:
+ return howto_table + R_PCRWORD;
+ case BFD_RELOC_8:
+ return howto_table + R_RELBYTE;
+ case BFD_RELOC_8_PCREL:
+ return howto_table + R_PCRBYTE;
default:
BFD_FAIL ();
return 0;
@@ -650,6 +658,6 @@ const bfd_target
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
NULL,
-
+
COFF_SWAP_TABLE
};
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 42e87c9..c400d61 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-17 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * gas/i386/i386.exp: Enable reloc and white tests for COFF.
+ * gas/i386/reloc.d: Accept dir32 relocs.
+
1999-09-12 Donn Terry <donn@interix.com>
* gas/all/gas.exp: Run cofftag test for i*86-*-interix*.
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 25ed69f..9401136 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -28,8 +28,8 @@ if [istarget "i*86-*-*"] then {
run_dump_test "katmai"
# The reloc and white tests require support for 8 and 16 bit
- # relocs, so we only run them for ELF targets.
- if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"]} then {
+ # relocs, so we only run them for ELF and COFF targets.
+ if {[istarget "*-*-elf*"] || [istarget "*-*-linux*"] || [istarget "*-*-coff*"]} then {
run_dump_test "reloc"
run_list_test "white" "-al --listing-lhs-width=3"
}
diff --git a/gas/testsuite/gas/i386/reloc.d b/gas/testsuite/gas/i386/reloc.d
index b3b6feb..3a95eed 100644
--- a/gas/testsuite/gas/i386/reloc.d
+++ b/gas/testsuite/gas/i386/reloc.d
@@ -7,11 +7,11 @@ Disassembly of section .text:
0+000 <foo>:
0: b3 00 [ ]*mov \$0x0,%bl 1: (R_386_)?8 .text
- 2: 68 00 00 00 00 [ ]*push \$0x0 3: (R_386_)?32 .text
- 7: 05 00 00 00 00 [ ]*add \$0x0,%eax 8: (R_386_)?32 .text
- c: 81 c3 00 00 00 00 [ ]*add \$0x0,%ebx e: (R_386_)?32 .text
- 12: 69 d2 00 00 00 00 [ ]*imul \$0x0,%edx,%edx 14: (R_386_)?32 .text
- 18: 9a 00 00 00 00 00 00 [ ]*lcall \$0x0,\$0x0 19: (R_386_)?32 .text
+ 2: 68 00 00 00 00 [ ]*push \$0x0 3: (R_386_)?(dir)?32 .text
+ 7: 05 00 00 00 00 [ ]*add \$0x0,%eax 8: (R_386_)?(dir)?32 .text
+ c: 81 c3 00 00 00 00 [ ]*add \$0x0,%ebx e: (R_386_)?(dir)?32 .text
+ 12: 69 d2 00 00 00 00 [ ]*imul \$0x0,%edx,%edx 14: (R_386_)?(dir)?32 .text
+ 18: 9a 00 00 00 00 00 00 [ ]*lcall \$0x0,\$0x0 19: (R_386_)?(dir)?32 .text
1f: 66 68 00 00 [ ]*pushw \$0x0 21: (R_386_)?16 .text
23: 90 [ ]*nop
24: 90 [ ]*nop
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 9bb2008..650d325 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-17 Alan Modra <alan@spri.levels.unisa.edu.au>
+
+ * ld-shared/shared.exp: xfail linux*libc1 shared (non PIC, load
+ offset) test.
+
1999-09-12 Ian Lance Taylor <ian@zembu.com>
* ld-scripts/script.exp: Add --image-base 0 for PE targets.
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 6c099a5..6eb0a8c 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -203,6 +203,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
# relocations for various targets are broken in the case where
# the load address is not zero (which is the default).
setup_xfail "*-*-sunos4*"
+ setup_xfail "*-*-linux*libc1"
shared_test shnp "shared (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o shared \
"-T $srcdir/$subdir/elf-offset.ld"