summaryrefslogtreecommitdiff
path: root/bfd/reloc.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-06-11 20:23:58 +0000
committerIan Lance Taylor <ian@airs.com>1999-06-11 20:23:58 +0000
commit0c53924562c5f52272485d7195b18f7b499681cf (patch)
treefa91da1a45d90b4d0fb59d4bf2da092a6dc7baad /bfd/reloc.c
parentc2506ba82ca2c0dbee7fb79197738da4b735f053 (diff)
downloadgdb-0c53924562c5f52272485d7195b18f7b499681cf.tar.gz
* reloc.c (_bfd_relocate_contents): Permit bitfield relocations to
wrap if the relocation covers the high bit of an address.
Diffstat (limited to 'bfd/reloc.c')
-rw-r--r--bfd/reloc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 9e8735e5ed6..360c1b2799b 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -1560,6 +1560,15 @@ _bfd_relocate_contents (howto, input_bfd, relocation, location)
/* We just assume (b & ~ fieldmask) == 0. */
+ /* We explicitly permit wrap around if this relocation
+ covers the high bit of an address. The Linux kernel
+ relies on it, and it is the only way to write assembler
+ code which can run when loaded at a location 0x80000000
+ away from the location at which it is linked. */
+ if (howto->bitsize + rightshift
+ == bfd_arch_bits_per_address (input_bfd))
+ break;
+
sum = a + b;
if (sum < a || (sum & ~ fieldmask) != 0)
{