| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mips_reloc.c,v 1.64 2016/02/19 22:09:09 macallan Exp $ */ | | 1 | /* $NetBSD: mips_reloc.c,v 1.65 2016/02/20 15:20:23 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1997 Michael L. Hitch <mhitch@montana.edu> | | 4 | * Copyright 1997 Michael L. Hitch <mhitch@montana.edu> |
5 | * Portions copyright 2002 Charles M. Hannum <root@ihack.net> | | 5 | * Portions copyright 2002 Charles M. Hannum <root@ihack.net> |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | */ | | 29 | */ |
30 | | | 30 | |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | #ifndef lint | | 32 | #ifndef lint |
33 | __RCSID("$NetBSD: mips_reloc.c,v 1.64 2016/02/19 22:09:09 macallan Exp $"); | | 33 | __RCSID("$NetBSD: mips_reloc.c,v 1.65 2016/02/20 15:20:23 christos Exp $"); |
34 | #endif /* not lint */ | | 34 | #endif /* not lint */ |
35 | | | 35 | |
36 | #include <sys/types.h> | | 36 | #include <sys/types.h> |
37 | #include <sys/endian.h> | | 37 | #include <sys/endian.h> |
38 | #include <sys/tls.h> | | 38 | #include <sys/tls.h> |
39 | | | 39 | |
40 | #include <stdlib.h> | | 40 | #include <stdlib.h> |
41 | #include <string.h> | | 41 | #include <string.h> |
42 | | | 42 | |
43 | #include "debug.h" | | 43 | #include "debug.h" |
44 | #include "rtld.h" | | 44 | #include "rtld.h" |
45 | | | 45 | |
46 | #ifdef __mips_o32 | | 46 | #ifdef __mips_o32 |
| @@ -435,27 +435,27 @@ _rtld_relocate_nonplt_objects(Obj_Entry | | | @@ -435,27 +435,27 @@ _rtld_relocate_nonplt_objects(Obj_Entry |
435 | def = _rtld_find_symdef(r_symndx, obj, &defobj, false); | | 435 | def = _rtld_find_symdef(r_symndx, obj, &defobj, false); |
436 | if (def == NULL) | | 436 | if (def == NULL) |
437 | return -1; | | 437 | return -1; |
438 | | | 438 | |
439 | if (!defobj->tls_done && _rtld_tls_offset_allocate(obj)) | | 439 | if (!defobj->tls_done && _rtld_tls_offset_allocate(obj)) |
440 | return -1; | | 440 | return -1; |
441 | | | 441 | |
442 | val += (Elf_Addr)(def->st_value + defobj->tlsoffset | | 442 | val += (Elf_Addr)(def->st_value + defobj->tlsoffset |
443 | - TLS_TP_OFFSET); | | 443 | - TLS_TP_OFFSET); |
444 | store_ptr(where, val, ELFSIZE / 8); | | 444 | store_ptr(where, val, ELFSIZE / 8); |
445 | | | 445 | |
446 | rdbg(("TPREL %s in %s --> %p in %s", | | 446 | rdbg(("TPREL %s in %s --> %p in %s", |
447 | obj->strtab + obj->symtab[r_symndx].st_name, | | 447 | obj->strtab + obj->symtab[r_symndx].st_name, |
448 | obj->path, (void *)where, defobj->path)); | | 448 | obj->path, where, defobj->path)); |
449 | break; | | 449 | break; |
450 | } | | 450 | } |
451 | | | 451 | |
452 | default: | | 452 | default: |
453 | rdbg(("sym = %lu, type = %lu, offset = %p, " | | 453 | rdbg(("sym = %lu, type = %lu, offset = %p, " |
454 | "contents = %p, symbol = %s", | | 454 | "contents = %p, symbol = %s", |
455 | (u_long)r_symndx, (u_long)ELF_R_TYPE(rel->r_info), | | 455 | (u_long)r_symndx, (u_long)ELF_R_TYPE(rel->r_info), |
456 | (void *)rel->r_offset, | | 456 | (void *)rel->r_offset, |
457 | (void *)load_ptr(where, sizeof(Elf_Sword)), | | 457 | (void *)load_ptr(where, sizeof(Elf_Sword)), |
458 | obj->strtab + obj->symtab[r_symndx].st_name)); | | 458 | obj->strtab + obj->symtab[r_symndx].st_name)); |
459 | _rtld_error("%s: Unsupported relocation type %ld " | | 459 | _rtld_error("%s: Unsupported relocation type %ld " |
460 | "in non-PLT relocations", | | 460 | "in non-PLT relocations", |
461 | obj->path, (u_long) ELF_R_TYPE(rel->r_info)); | | 461 | obj->path, (u_long) ELF_R_TYPE(rel->r_info)); |