CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: joerg Date: Mon Dec 25 17:00:16 UTC 2017 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Since GNU ld doesn't honor the PLT entry reservation, also compensate for JMP_IREL relocations at the start of the PLT. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.66 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.67 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.66 Mon Nov 6 21:16:04 2017 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Mon Dec 25 17:00:15 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.66 2017/11/06 21:16:04 joerg Exp $ */ +/* $NetBSD: mdreloc.c,v 1.67 2017/12/25 17:00:15 joerg Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.66 2017/11/06 21:16:04 joerg Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.67 2017/12/25 17:00:15 joerg Exp $"); #endif /* not lint */ #include @@ -533,7 +533,8 @@ _rtld_bind(const Obj_Entry *obj, Elf_Wor result = 0; /* XXX gcc */ - if (ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_SLOT)) { + if (ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_SLOT) || + ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_IREL)) { /* * * @@ -546,8 +547,9 @@ _rtld_bind(const Obj_Entry *obj, Elf_Wor * * So, to provide binary compatibility, we will check the first * entry, if it is reserved it should not be of the type - * JMP_SLOT. If it is JMP_SLOT, then the 4 reserved entries - * were not generated and our index is 4 entries too far. + * JMP_SLOT or JMP_REL. If it is either of those, then + * the 4 reserved entries were not generated and our index + * is 4 entries too far. */ rela -= 4; } @@ -572,7 +574,8 @@ _rtld_relocate_plt_objects(const Obj_Ent * Check for first four reserved entries - and skip them. * See above for details. */ - if (ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_SLOT)) + if (ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_SLOT) && + ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_IREL)) rela += 4; for (; rela < obj->pltrelalim; rela++)
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Mon Jul 24 08:08:34 UTC 2017 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Fix thinko in previous: even if the address is an unsigned value and we have verified the range before, we still need to mask the bit pattern to the target instruction field. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.62 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.63 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.62 Sun Jul 23 14:37:51 2017 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Mon Jul 24 08:08:34 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.62 2017/07/23 14:37:51 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.63 2017/07/24 08:08:34 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.62 2017/07/23 14:37:51 martin Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.63 2017/07/24 08:08:34 martin Exp $"); #endif /* not lint */ #include @@ -651,7 +651,7 @@ _rtld_relocate_plt_object(const Obj_Entr * nop * */ - where[1] = BAA | (offBAA >> 2); + where[1] = BAA | ((offBAA >> 2) & 0x7); __asm volatile("iflush %0+4" : : "r" (where)); } else if (value < (1L<<32)) { /*
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Sun Jul 23 14:37:51 UTC 2017 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Simplify and fix the offset calculation when doing a %pc relative branch from the PLT slot to the target. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.61 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.62 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.61 Mon Jun 19 11:57:02 2017 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Sun Jul 23 14:37:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.61 2017/06/19 11:57:02 joerg Exp $ */ +/* $NetBSD: mdreloc.c,v 1.62 2017/07/23 14:37:51 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.61 2017/06/19 11:57:02 joerg Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.62 2017/07/23 14:37:51 martin Exp $"); #endif /* not lint */ #include @@ -579,7 +579,7 @@ _rtld_relocate_plt_object(const Obj_Entr Elf_Word *where = (Elf_Word *)(obj->relocbase + rela->r_offset); const Elf_Sym *def; const Obj_Entry *defobj; - Elf_Addr value, offset; + Elf_Addr value, offset, offBAA; unsigned long info = rela->r_info; assert(ELF_R_TYPE(info) == R_TYPE(JMP_SLOT)); @@ -625,6 +625,7 @@ _rtld_relocate_plt_object(const Obj_Entr */ offset = ((Elf_Addr)where) - value; + offBAA = value - (((Elf_Addr)where) +4); /* ba,a at where[1] */ if (rela->r_addend) { Elf_Addr *ptr = (Elf_Addr *)where; /* @@ -634,7 +635,7 @@ _rtld_relocate_plt_object(const Obj_Entr */ ptr[0] += value - (Elf_Addr)obj->pltgot; - } else if (offset <= (1L<<20) && (Elf_SOff)offset >= -(1L<<20)) { + } else if (offBAA <= (1L<<20) && (Elf_SOff)offBAA >= -(1L<<20)) { /* * We're within 1MB -- we can use a direct branch insn. * @@ -650,7 +651,7 @@ _rtld_relocate_plt_object(const Obj_Entr * nop * */ - where[1] = BAA | ((offset >> 2) & 0x7); + where[1] = BAA | (offBAA >> 2); __asm volatile("iflush %0+4" : : "r" (where)); } else if (value < (1L<<32)) { /*
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: joerg Date: Thu Jun 15 23:10:12 UTC 2017 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Fix indentation. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.59 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.60 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.59 Mon Aug 29 16:00:10 2016 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Thu Jun 15 23:10:12 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.60 2017/06/15 23:10:12 joerg Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.60 2017/06/15 23:10:12 joerg Exp $"); #endif /* not lint */ #include @@ -352,57 +352,55 @@ _rtld_relocate_nonplt_objects(Obj_Entry */ if (RELOC_TLS(type)) { switch (type) { -case R_TYPE(TLS_DTPMOD64): - def = _rtld_find_symdef(symnum, obj, - , false); - if (def == NULL) - return -1; - - *where = (Elf64_Addr)defobj->tlsindex; - - rdbg(("TLS_DTPMOD64 %s in %s --> %p", - obj->strtab + - obj->symtab[symnum].st_name, - obj->path, (void *)*where)); - - break; - -case R_TYPE(TLS_DTPOFF64): - def = _rtld_find_symdef(symnum, obj, - , false); - if (def == NULL) - return -1; - - *where = (Elf64_Addr)(def->st_value - + rela->r_addend); - - rdbg(("DTPOFF64 %s in %s --> %p", - obj->strtab + - obj->symtab[symnum].st_name, - obj->path, (void *)*where)); - - break; - -case R_TYPE(TLS_TPOFF64): - def = _rtld_find_symdef(symnum, obj, - , false); - if (def == NULL) - return -1; - - if (!defobj->tls_done && - _rtld_tls_offset_allocate(obj)) - return -1; - - *where = (Elf64_Addr)(def->st_value - - defobj->tlsoffset + - rela->r_addend); - - rdbg(("TLS_TPOFF64 %s in %s --> %p", - obj->strtab + - obj->symtab[symnum].st_name, - obj->path, (void *)*where)); + case R_TYPE(TLS_DTPMOD64): +def = _rtld_find_symdef(symnum, obj, +, false); +if (def == NULL) + return -1; + +*where = (Elf64_Addr)defobj->tlsindex; + +rdbg(("TLS_DTPMOD64 %s in %s --> %p", +obj->strtab + +obj->symtab[symnum].st_name, +obj->path, (void *)*where)); + +break; + + case R_TYPE(TLS_DTPOFF64): +def = _rtld_find_symdef(symnum, obj, +, false); +if (def == NULL) + return -1; + +*where = (Elf64_Addr)(def->st_value ++ rela->r_addend); + +rdbg(("DTPOFF64 %s in %s --> %p", +obj->strtab + +obj->symtab[symnum].st_name, +obj->path, (void *)*where)); + +break; + + case R_TYPE(TLS_TPOFF64): +def = _rtld_find_symdef(symnum, obj, +, false); +if (def == NULL) + return -1; + +if (!defobj->tls_done && + _rtld_tls_offset_allocate(obj)) + return -1; + +*where = (Elf64_Addr)(def->st_value - +defobj->tlsoffset + rela->r_addend); + +rdbg(("TLS_TPOFF64 %s in %s --> %p", +obj->strtab + obj->symtab[symnum].st_name, +obj->path, (void *)*where)); - break; +break; } continue; }
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Mon Aug 29 16:00:10 UTC 2016 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Despite the 10 in the name, the OLO10 relocation targets a 13 bit field, the offset (O) providing the additional data. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.58 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.59 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.58 Mon Jun 20 08:12:25 2016 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Mon Aug 29 16:00:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.58 2016/06/20 08:12:25 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.58 2016/06/20 08:12:25 martin Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.59 2016/08/29 16:00:10 martin Exp $"); #endif /* not lint */ #include @@ -175,7 +175,7 @@ static const long reloc_target_bitmask[] _BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ _BM(10), _BM(11), -1, /* _10, _11, _64 */ - _BM(10), _BM(22), /* _OLO10, _HH22 */ + _BM(13), _BM(22), /* _OLO10, _HH22 */ _BM(10), _BM(22), /* _HM10, _LM22 */ _BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(16), _BM(19), /* _WDISP16, _WDISP19 */
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Mon Jun 20 08:12:25 UTC 2016 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Fix a few bounds and instruction sequences generated in the PLT; exercised by ASLR and verified to work with the aslr fixed random debug sysctls. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.57 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.58 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.57 Mon Aug 25 20:40:53 2014 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Mon Jun 20 08:12:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.57 2014/08/25 20:40:53 joerg Exp $ */ +/* $NetBSD: mdreloc.c,v 1.58 2016/06/20 08:12:25 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mdreloc.c,v 1.57 2014/08/25 20:40:53 joerg Exp $"); +__RCSID("$NetBSD: mdreloc.c,v 1.58 2016/06/20 08:12:25 martin Exp $"); #endif /* not lint */ #include @@ -202,6 +202,7 @@ static const long reloc_target_bitmask[] #define MOV17 0x9e106000 /* or %g1, 0, %o7 */ #define CALL 0x4000 /* call 0 */ #define SLLX 0x83287000 /* sllx %g1, 0, %g1 */ +#define NEG 0x8221 /* neg %g1 */ #define SETHIG5 0x0b00 /* sethi %hi(0), %g5 */ #define ORG5 0x82104005 /* or %g1, %g5, %g1 */ @@ -662,7 +663,7 @@ _rtld_relocate_plt_object(const Obj_Entr * nop * */ - where[1] = BAA | ((offset >> 2) & 0x3f); + where[1] = BAA | ((offset >> 2) & 0x7); __asm volatile("iflush %0+4" : : "r" (where)); } else if (value < (1L<<32)) { /* @@ -708,7 +709,8 @@ _rtld_relocate_plt_object(const Obj_Entr __asm volatile("iflush %0+8" : : "r" (where)); __asm volatile("iflush %0+4" : : "r" (where)); - } else if (offset <= (1L<<32) && (Elf_SOff)offset >= -((1L<<32) - 4)) { + } else if ((offset+8) <= (1L<<31) && + (Elf_SOff)(offset+8) >= -((1L<<31) - 4)) { /* * We're within 32-bits -- we can use a direct call insn * @@ -724,14 +726,15 @@ _rtld_relocate_plt_object(const Obj_Entr * nop * */ + offset += 8; /* call is at where[2], 8 byte further */ where[3] = MOV17; - where[2] = CALL | ((offset >> 4) & 0x3fff); + where[2] = CALL | ((-offset >> 2) & 0x3fff); where[1] = MOV71; __asm volatile("iflush %0+12" : : "r" (where)); __asm volatile("iflush %0+8" : : "r" (where)); __asm volatile("iflush %0+4" : : "r" (where)); - } else if (offset < (1L<<44)) { + } else if ((Elf_SOff)value > 0 && value < (1L<<44)) { /* * We're within 44 bits. We can generate this pattern: * @@ -747,35 +750,38 @@ _rtld_relocate_plt_object(const Obj_Entr * nop * */ - where[4] = JMP | LOVAL(offset, 0); + where[4] = JMP | LOVAL(value, 0); where[3] = SLLX | 12; - where[2] = OR| (((offset) >> 12) & 0x1fff); - where[1] = SETHI | HIVAL(offset, 22); + where[2] = OR| (((value) >> 12) & 0x1fff); + where[1] = SETHI | HIVAL(value, 22); __asm volatile("iflush %0+16" : : "r" (where)); __asm volatile("iflush %0+12" : : "r" (where)); __asm volatile("iflush %0+8" : : "r" (where)); __asm volatile("iflush %0+4" : : "r" (where)); - } else if ((Elf_SOff)offset < 0 && (Elf_SOff)offset > -(1L<<44)) { - /* - * We're within 44 bits. We can generate this pattern: + } else if ((Elf_SOff)value < 0 && (Elf_SOff)value > -(1L<<44)) { + /* + * We're within 44 bits. We can generate this pattern: * * The resulting code in the jump slot is: * * sethi %hi(. - .PLT0), %g1 - * sethi %h44(-addr), %g1 - * xor %g1, %m44(-addr), %g1 - * sllx %g1, 12, %g1 - * jmp %g1+%l44(addr) - * nop + * sethi %hi((-addr)>>12), %g1 + * or %g1, %lo((-addr)>>12), %g1 + * neg %g1 + * sllx %g1, 12, %g1 + * jmp %g1+(addr&0x0fff) * nop * nop * */ - where[4] = JMP | LOVAL(offset, 0); - where[3] = SLLX | 12; - where[2] = XOR | (((~offset) >> 12) & 0x1fff); - where[1] = SETHI | HIVAL(~offset, 22); + Elf_Addr neg = (~value+1)>>12; + where[5] = JMP | (value & 0x0fff); + where[4] = SLLX | 12; + where[3] = NEG; + where[2] = OR| (LOVAL(neg, 0)+1); + where[1] = SETHI | HIVAL(neg, 10); + __asm volatile("iflush %0+20" : : "r" (where)); __asm volatile("iflush %0+16" : : "r" (where)); __asm volatile("iflush %0+12" : : "r" (where)); __asm volatile("iflush %0+8" : : "r" (where));
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Wed Apr 2 14:11:25 UTC 2014 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: The table of masks applied for each relocation type was wrong for some relocs with 64bit targets, like GLOB_DAT. Change some instruction patterns used for PLT slots, so -current objdump -d shows what the comment says. Fix encoding of %lox() in PLT slots close to -1. Enhance debug output slightly. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.55 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.56 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.55 Thu Oct 3 10:45:57 2013 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Wed Apr 2 14:11:25 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.55 2013/10/03 10:45:57 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.56 2014/04/02 14:11:25 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.55 2013/10/03 10:45:57 martin Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.56 2014/04/02 14:11:25 martin Exp $); #endif /* not lint */ #include errno.h @@ -170,7 +170,7 @@ static const long reloc_target_bitmask[] _BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */ _BM(10), _BM(22), /* _PC10, _PC22 */ _BM(30), 0, /* _WPLT30, _COPY */ - _BM(32), _BM(32), _BM(32), /* _GLOB_DAT, JMP_SLOT, _RELATIVE */ + -1, _BM(32), -1, /* _GLOB_DAT, JMP_SLOT, _RELATIVE */ _BM(32), _BM(32), /* _UA32, PLT32 */ _BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ @@ -192,18 +192,18 @@ static const long reloc_target_bitmask[] /* * Instruction templates: */ -#define BAA 0x1040 /* ba,a %xcc, 0 */ +#define BAA 0x3068 /* ba,a %xcc, 0 */ #define SETHI 0x0300 /* sethi %hi(0), %g1 */ #define JMP 0x81c06000 /* jmpl %g1+%lo(0), %g0 */ #define NOP 0x0100 /* sethi %hi(0), %g0 */ -#define OR 0x82806000 /* or %g1, 0, %g1 */ -#define XOR 0x82c06000 /* xor %g1, 0, %g1 */ -#define MOV71 0x8283a000 /* or %o7, 0, %g1 */ -#define MOV17 0x9c806000 /* or %g1, 0, %o7 */ +#define OR 0x82106000 /* or %g1, 0, %g1 */ +#define XOR 0x82186000 /* xor %g1, 0, %g1 */ +#define MOV71 0x8213e000 /* or %o7, 0, %g1 */ +#define MOV17 0x9e106000 /* or %g1, 0, %o7 */ #define CALL 0x4000 /* call 0 */ -#define SLLX 0x8b407000 /* sllx %g1, 0, %g1 */ +#define SLLX 0x83287000 /* sllx %g1, 0, %g1 */ #define SETHIG5 0x0b00 /* sethi %hi(0), %g5 */ -#define ORG5 0x82804005 /* or %g1, %g5, %g1 */ +#define ORG5 0x82104005 /* or %g1, %g5, %g1 */ /* %hi(v)/%lo(v) with variable shift */ @@ -603,8 +603,8 @@ _rtld_relocate_plt_object(const Obj_Entr return 0; value = (Elf_Addr)(defobj-relocbase + def-st_value); - rdbg((bind now/fixup in %s -- new=%p, - defobj-strtab + def-st_name, (void *)value)); + rdbg((bind now/fixup in %s at %p -- new=%p, + defobj-strtab + def-st_name, (void*)where, (void *)value)); /* * At the PLT entry pointed at by `where', we now construct a direct @@ -696,7 +696,7 @@ _rtld_relocate_plt_object(const Obj_Entr * */ where[3] = JMP; - where[2] = XOR | ((~value) 0x1fff); + where[2] = XOR | (value 0x3ff) | 0x1c00; where[1] = SETHI | HIVAL(~value, 10); __asm volatile(iflush %0+12 : : r (where)); __asm volatile(iflush %0+8 : : r (where));
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Thu Oct 3 10:45:57 UTC 2013 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: The R_SPARC_L44 relocation type is documented to be truncating and calculated as (S + A) 0xfff - so while it (usually) sets a imm13 field in the opcode, only 12 bits of the calculated value can be used. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.54 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.55 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.54 Mon Sep 23 21:00:35 2013 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Thu Oct 3 10:45:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.54 2013/09/23 21:00:35 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.55 2013/10/03 10:45:57 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.54 2013/09/23 21:00:35 martin Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.55 2013/10/03 10:45:57 martin Exp $); #endif /* not lint */ #include errno.h @@ -183,7 +183,7 @@ static const long reloc_target_bitmask[] _BM(7), _BM(5), _BM(6), /* _7, _5, _6 */ -1, -1,/* DISP64, PLT64 */ _BM(22), _BM(13), /* HIX22, LOX10 */ - _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */ + _BM(22), _BM(10), _BM(12), /* H44, M44, L44 */ -1, -1, _BM(16), /* REGISTER, UA64, UA16 */ #undef _BM };
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Mon Sep 23 21:00:35 UTC 2013 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Missing , in table initializer To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.53 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.54 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.53 Sun Jul 22 09:21:03 2012 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Mon Sep 23 21:00:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.53 2012/07/22 09:21:03 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.54 2013/09/23 21:00:35 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.53 2012/07/22 09:21:03 martin Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.54 2013/09/23 21:00:35 martin Exp $); #endif /* not lint */ #include errno.h @@ -180,7 +180,7 @@ static const long reloc_target_bitmask[] _BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(16), _BM(19), /* _WDISP16, _WDISP19 */ -1,/* GLOB_JMP */ - _BM(7), _BM(5), _BM(6) /* _7, _5, _6 */ + _BM(7), _BM(5), _BM(6), /* _7, _5, _6 */ -1, -1,/* DISP64, PLT64 */ _BM(22), _BM(13), /* HIX22, LOX10 */ _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Sun Jul 22 09:21:03 UTC 2012 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Add special handling needed for OLO10 relocations. First part of fixing PR port-sparc64/46724. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.52 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.53 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.52 Wed Mar 30 08:37:52 2011 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Sun Jul 22 09:21:03 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $ */ +/* $NetBSD: mdreloc.c,v 1.53 2012/07/22 09:21:03 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.53 2012/07/22 09:21:03 martin Exp $); #endif /* not lint */ #include errno.h @@ -323,6 +323,10 @@ _rtld_relocate_nonplt_objects(Obj_Entry if (type == R_TYPE(NONE)) continue; + /* OLO10 relocations have extra info */ + if ((type 0x00ff) == R_SPARC_OLO10) + type = R_SPARC_OLO10; + /* We do JMP_SLOTs in _rtld_bind() below */ if (type == R_TYPE(JMP_SLOT)) continue; @@ -335,8 +339,10 @@ _rtld_relocate_nonplt_objects(Obj_Entry * We use the fact that relocation types are an `enum' * Note: R_SPARC_TLS_TPOFF64 is currently numerically largest. */ - if (type R_TYPE(TLS_TPOFF64)) - return (-1); + if (type R_TYPE(TLS_TPOFF64)) { + dbg((unknown relocation type %x at %p, type, rela)); + return -1; + } value = rela-r_addend; @@ -422,6 +428,11 @@ _rtld_relocate_nonplt_objects(Obj_Entry value += (Elf_Addr)(defobj-relocbase + def-st_value); } + if (type == R_SPARC_OLO10) { + value = (value 0x3ff) + + (((Elf64_Xword)rela-r_info32)40); + } + if (RELOC_PC_RELATIVE(type)) { value -= (Elf_Addr)where; }
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Wed Mar 30 08:37:52 UTC 2011 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Add support for 64 bit TLS relocations. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.51 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.52 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.51 Fri Mar 25 18:07:06 2011 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Wed Mar 30 08:37:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.51 2011/03/25 18:07:06 joerg Exp $ */ +/* $NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.51 2011/03/25 18:07:06 joerg Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $); #endif /* not lint */ #include errno.h @@ -67,7 +67,7 @@ #define _RF_U 0x0400 /* Unaligned */ #define _RF_SZ(s) (((s) 0xff) 8) /* memory target size */ #define _RF_RS(s) ( (s) 0xff) /* right shift */ -static const int reloc_target_flags[] = { +static const int reloc_target_flags[R_TYPE(TLS_TPOFF64)+1] = { 0, /* NONE */ _RF_S|_RF_A| _RF_SZ(8) | _RF_RS(0), /* RELOC_8 */ _RF_S|_RF_A| _RF_SZ(16) | _RF_RS(0), /* RELOC_16 */ @@ -125,6 +125,7 @@ _RF_S|_RF_A| _RF_SZ(64) | _RF_RS(0), /* REGISTER */ _RF_S|_RF_A| _RF_U| _RF_SZ(64) | _RF_RS(0), /* UA64 */ _RF_S|_RF_A| _RF_U| _RF_SZ(16) | _RF_RS(0), /* UA16 */ +/* TLS relocs not represented here! */ }; #ifdef RTLD_DEBUG_RELOC @@ -139,7 +140,13 @@ HM10, LM22, PC_HH22, PC_HM10, PC_LM22, WDISP16, WDISP19, GLOB_JMP, 7, 5, 6, DISP64, PLT64, HIX22, LOX10, H44, M44, - L44, REGISTER, UA64, UA16 + L44, REGISTER, UA64, UA16, + TLS_GD_HI22, TLS_GD_LO10, TLS_GD_ADD, TLS_GD_CALL, + TLS_LDM_HI22, TLS_LDM_LO10, TLS_LDM_ADD, TLS_LDM_CALL, + TLS_LDO_HIX22, TLS_LDO_LOX10, TLS_LDO_ADD, TLS_IE_HI22, + TLS_IE_LO10, TLS_IE_LD, TLS_IE_LDX, TLS_IE_ADD, TLS_LE_HIX22, + TLS_LE_LOX10, TLS_DTPMOD32, TLS_DTPMOD64, TLS_DTPOFF32, + TLS_DTPOFF64, TLS_TPOFF32, TLS_TPOFF64, }; #endif @@ -150,6 +157,7 @@ #define RELOC_USE_ADDEND(t) ((reloc_target_flags[t] _RF_A) != 0) #define RELOC_TARGET_SIZE(t) ((reloc_target_flags[t] 8) 0xff) #define RELOC_VALUE_RIGHTSHIFT(t) (reloc_target_flags[t] 0xff) +#define RELOC_TLS(t) (t = R_TYPE(TLS_GD_HI22)) static const long reloc_target_bitmask[] = { #define _BM(x) (~(-(1ULL (x @@ -325,14 +333,74 @@ /* * We use the fact that relocation types are an `enum' - * Note: R_SPARC_UA16 is currently numerically largest. + * Note: R_SPARC_TLS_TPOFF64 is currently numerically largest. */ - if (type R_TYPE(UA16)) + if (type R_TYPE(TLS_TPOFF64)) return (-1); value = rela-r_addend; /* + * Handle TLS relocations here, they are different. + */ + if (RELOC_TLS(type)) { + switch (type) { +case R_TYPE(TLS_DTPMOD64): + def = _rtld_find_symdef(symnum, obj, + defobj, false); + if (def == NULL) + return -1; + + *where = (Elf64_Addr)defobj-tlsindex; + + rdbg((TLS_DTPMOD64 %s in %s -- %p, + obj-strtab + + obj-symtab[symnum].st_name, + obj-path, (void *)*where)); + + break; + +case R_TYPE(TLS_DTPOFF64): + def = _rtld_find_symdef(symnum, obj, + defobj, false); + if (def == NULL) + return -1; + + *where = (Elf64_Addr)(def-st_value + + rela-r_addend); + + rdbg((DTPOFF64 %s in %s -- %p, + obj-strtab + + obj-symtab[symnum].st_name, + obj-path, (void *)*where)); + + break; + +case R_TYPE(TLS_TPOFF64): + def = _rtld_find_symdef(symnum, obj, + defobj, false); + if (def == NULL) + return -1; + + if (!defobj-tls_done + _rtld_tls_offset_allocate(obj)) + return -1; + + *where = (Elf64_Addr)(def-st_value - + defobj-tlsoffset + + rela-r_addend); + + rdbg((TLS_TPOFF64 %s in %s -- %p, + obj-strtab + + obj-symtab[symnum].st_name, + obj-path, (void *)*where)); + + break; + } + continue; + } + + /* * Handle relative relocs here, as an optimization. */ if (type == R_TYPE(RELATIVE)) {
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: skrll Date: Fri Sep 24 11:57:11 UTC 2010 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.47 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.48 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.47 Fri Aug 6 16:33:18 2010 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Fri Sep 24 11:57:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.47 2010/08/06 16:33:18 joerg Exp $ */ +/* $NetBSD: mdreloc.c,v 1.48 2010/09/24 11:57:11 skrll Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.47 2010/08/06 16:33:18 joerg Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.48 2010/09/24 11:57:11 skrll Exp $); #endif /* not lint */ #include errno.h @@ -554,7 +554,7 @@ if (rela-r_addend) { Elf_Addr *ptr = (Elf_Addr *)where; /* - * This entry is =32768. The relocations points to a + * This entry is = 32768. The relocations points to a * PC-relative pointer to the bind_0 stub at the top of the * PLT section. Update it to point to the target function. */ @@ -576,7 +576,7 @@ * nop * */ - where[1] = BAA | ((offset 2) 0x3f); + where[1] = BAA | ((offset 2) 0x3f); __asm volatile(iflush %0+4 : : r (where)); } else if (value (1L32)) { /*
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: skrll Date: Fri Sep 24 11:59:28 UTC 2010 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Wrap long line. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.48 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.49 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.48 Fri Sep 24 11:57:11 2010 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Fri Sep 24 11:59:28 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.48 2010/09/24 11:57:11 skrll Exp $ */ +/* $NetBSD: mdreloc.c,v 1.49 2010/09/24 11:59:28 skrll Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.48 2010/09/24 11:57:11 skrll Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.49 2010/09/24 11:59:28 skrll Exp $); #endif /* not lint */ #include errno.h @@ -504,7 +504,8 @@ * _rtld_bind */ static inline int -_rtld_relocate_plt_object(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *tp) +_rtld_relocate_plt_object(const Obj_Entry *obj, const Elf_Rela *rela, +Elf_Addr *tp) { Elf_Word *where = (Elf_Word *)(obj-relocbase + rela-r_offset); const Elf_Sym *def;
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: skrll Date: Fri Sep 24 12:00:10 UTC 2010 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Comment reformat. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.49 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.50 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.49 Fri Sep 24 11:59:28 2010 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Fri Sep 24 12:00:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.49 2010/09/24 11:59:28 skrll Exp $ */ +/* $NetBSD: mdreloc.c,v 1.50 2010/09/24 12:00:10 skrll Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.49 2010/09/24 11:59:28 skrll Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.50 2010/09/24 12:00:10 skrll Exp $); #endif /* not lint */ #include errno.h @@ -526,9 +526,8 @@ defobj-strtab + def-st_name, (void *)value)); /* - * At the PLT entry pointed at by `where', we now construct - * a direct transfer to the now fully resolved function - * address. + * At the PLT entry pointed at by `where', we now construct a direct + * transfer to the now fully resolved function address. * * A PLT entry is supposed to start by looking like this: * @@ -541,14 +540,13 @@ * nop * nop * - * When we replace these entries we start from the second - * entry and do it in reverse order so the last thing we - * do is replace the branch. That allows us to change this - * atomically. + * When we replace these entries we start from the last instruction + * and do it in reverse order so the last thing we do is replace the + * branch. That allows us to change this atomically. * - * We now need to find out how far we need to jump. We - * have a choice of several different relocation techniques - * which are increasingly expensive. + * We now need to find out how far we need to jump. We have a choice + * of several different relocation techniques which are increasingly + * expensive. */ offset = ((Elf_Addr)where) - value;
CVS commit: src/libexec/ld.elf_so/arch/sparc64
Module Name:src Committed By: martin Date: Fri May 22 21:47:47 UTC 2009 Modified Files: src/libexec/ld.elf_so/arch/sparc64: mdreloc.c Log Message: Use the new Elf_SOff (signed offset) type to fix a few signed/unsigned problems. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ld.elf_so/arch/sparc64/mdreloc.c diff -u src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.44 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.45 --- src/libexec/ld.elf_so/arch/sparc64/mdreloc.c:1.44 Mon Mar 16 02:46:48 2009 +++ src/libexec/ld.elf_so/arch/sparc64/mdreloc.c Fri May 22 21:47:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mdreloc.c,v 1.44 2009/03/16 02:46:48 lukem Exp $ */ +/* $NetBSD: mdreloc.c,v 1.45 2009/05/22 21:47:46 martin Exp $ */ /*- * Copyright (c) 2000 Eduardo Horvath. @@ -32,7 +32,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: mdreloc.c,v 1.44 2009/03/16 02:46:48 lukem Exp $); +__RCSID($NetBSD: mdreloc.c,v 1.45 2009/05/22 21:47:46 martin Exp $); #endif /* not lint */ #include errno.h @@ -560,7 +560,7 @@ */ ptr[0] += value - (Elf_Addr)obj-pltgot; - } else if (offset = (1L20) offset = -(1L20)) { + } else if (offset = (1L20) (Elf_SOff)offset = -(1L20)) { /* * We're within 1MB -- we can use a direct branch insn. * @@ -578,7 +578,7 @@ */ where[1] = BAA | ((offset 2) 0x3f); __asm volatile(iflush %0+4 : : r (where)); - } else if (value = 0 value (1L32)) { + } else if (value (1L32)) { /* * We're within 32-bits of address zero. * @@ -599,7 +599,7 @@ __asm volatile(iflush %0+8 : : r (where)); __asm volatile(iflush %0+4 : : r (where)); - } else if (value = 0 value -(1L32)) { + } else if ((Elf_SOff)value = 0 (Elf_SOff)value -(1L32)) { /* * We're within 32-bits of address -1. * @@ -622,7 +622,7 @@ __asm volatile(iflush %0+8 : : r (where)); __asm volatile(iflush %0+4 : : r (where)); - } else if (offset = (1L32) offset = -((1L32) - 4)) { + } else if (offset = (1L32) (Elf_SOff)offset = -((1L32) - 4)) { /* * We're within 32-bits -- we can use a direct call insn * @@ -645,7 +645,7 @@ __asm volatile(iflush %0+8 : : r (where)); __asm volatile(iflush %0+4 : : r (where)); - } else if (offset = 0 offset (1L44)) { + } else if (offset (1L44)) { /* * We're within 44 bits. We can generate this pattern: * @@ -670,7 +670,7 @@ __asm volatile(iflush %0+8 : : r (where)); __asm volatile(iflush %0+4 : : r (where)); - } else if (offset 0 offset -(1L44)) { + } else if ((Elf_SOff)offset 0 (Elf_SOff)offset -(1L44)) { /* * We're within 44 bits. We can generate this pattern: *