Sat Feb 29 18:45:20 2020 UTC ()
Fix vax and mips build


(kamil)
diff -r1.72 -r1.73 src/libexec/ld.elf_so/symbol.c

cvs diff -r1.72 -r1.73 src/libexec/ld.elf_so/symbol.c (expand / switch to unified diff)

--- src/libexec/ld.elf_so/symbol.c 2020/02/29 04:24:33 1.72
+++ src/libexec/ld.elf_so/symbol.c 2020/02/29 18:45:20 1.73
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: symbol.c,v 1.72 2020/02/29 04:24:33 kamil Exp $ */ 1/* $NetBSD: symbol.c,v 1.73 2020/02/29 18:45:20 kamil Exp $ */
2 2
3/* 3/*
4 * Copyright 1996 John D. Polstra. 4 * Copyright 1996 John D. Polstra.
5 * Copyright 1996 Matt Thomas <matt@3am-software.com> 5 * Copyright 1996 Matt Thomas <matt@3am-software.com>
6 * Copyright 2002 Charles M. Hannum <root@ihack.net> 6 * Copyright 2002 Charles M. Hannum <root@ihack.net>
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35/* 35/*
36 * Dynamic linker for ELF. 36 * Dynamic linker for ELF.
37 * 37 *
38 * John Polstra <jdp@polstra.com>. 38 * John Polstra <jdp@polstra.com>.
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42#ifndef lint 42#ifndef lint
43__RCSID("$NetBSD: symbol.c,v 1.72 2020/02/29 04:24:33 kamil Exp $"); 43__RCSID("$NetBSD: symbol.c,v 1.73 2020/02/29 18:45:20 kamil Exp $");
44#endif /* not lint */ 44#endif /* not lint */
45 45
46#include <err.h> 46#include <err.h>
47#include <errno.h> 47#include <errno.h>
48#include <fcntl.h> 48#include <fcntl.h>
49#include <stdarg.h> 49#include <stdarg.h>
50#include <stdio.h> 50#include <stdio.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <string.h> 52#include <string.h>
53#include <unistd.h> 53#include <unistd.h>
54#include <sys/types.h> 54#include <sys/types.h>
55#include <sys/mman.h> 55#include <sys/mman.h>
56#include <sys/bitops.h> 56#include <sys/bitops.h>
@@ -215,27 +215,27 @@ _rtld_symlook_obj_matched_symbol(const c @@ -215,27 +215,27 @@ _rtld_symlook_obj_matched_symbol(const c
215 unsigned long symnum, const Elf_Sym **vsymp, int *vcount) 215 unsigned long symnum, const Elf_Sym **vsymp, int *vcount)
216{ 216{
217 const Elf_Sym *symp; 217 const Elf_Sym *symp;
218 const char *strp; 218 const char *strp;
219 Elf_Half verndx; 219 Elf_Half verndx;
220 220
221 symp = obj->symtab + symnum; 221 symp = obj->symtab + symnum;
222 strp = obj->strtab + symp->st_name; 222 strp = obj->strtab + symp->st_name;
223 rdbg(("check \"%s\" vs \"%s\" in %s", name, strp, obj->path)); 223 rdbg(("check \"%s\" vs \"%s\" in %s", name, strp, obj->path));
224 if (name[1] != strp[1] || strcmp(name, strp)) 224 if (name[1] != strp[1] || strcmp(name, strp))
225 return false; 225 return false;
226#if defined(__mips__) || defined(__vax__) 226#if defined(__mips__) || defined(__vax__)
227 if (symp->st_shndx == SHN_UNDEF) 227 if (symp->st_shndx == SHN_UNDEF)
228 continue; 228 return false;
229#else 229#else
230 /* 230 /*
231 * XXX DANGER WILL ROBINSON! 231 * XXX DANGER WILL ROBINSON!
232 * If we have a function pointer in the executable's 232 * If we have a function pointer in the executable's
233 * data section, it points to the executable's PLT 233 * data section, it points to the executable's PLT
234 * slot, and there is NO relocation emitted. To make 234 * slot, and there is NO relocation emitted. To make
235 * the function pointer comparable to function pointers 235 * the function pointer comparable to function pointers
236 * in shared libraries, we must resolve data references 236 * in shared libraries, we must resolve data references
237 * in the libraries to point to PLT slots in the 237 * in the libraries to point to PLT slots in the
238 * executable, if they exist. 238 * executable, if they exist.
239 */ 239 */
240 if (symp->st_shndx == SHN_UNDEF && 240 if (symp->st_shndx == SHN_UNDEF &&
241 ((flags & SYMLOOK_IN_PLT) || 241 ((flags & SYMLOOK_IN_PLT) ||