diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2009-05-30 23:37:04 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2009-05-30 23:37:04 +0000 |
commit | 1be013f78625228fd67258d8dd002d709b77c269 (patch) | |
tree | 97c43e871fa03f201e6bed1a6cca318965fc4430 /libexec/ld.so | |
parent | c239cd64597500749d5db24f73f2cf50ae549102 (diff) |
Airplane work, undefined weak variables not getting resolved is not an error.
Delete an unused manpage, remove some unused variables.
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/ldconfig/prebind.8 | 81 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/prebind.c | 23 |
2 files changed, 13 insertions, 91 deletions
diff --git a/libexec/ld.so/ldconfig/prebind.8 b/libexec/ld.so/ldconfig/prebind.8 deleted file mode 100644 index 71290b54e48..00000000000 --- a/libexec/ld.so/ldconfig/prebind.8 +++ /dev/null @@ -1,81 +0,0 @@ -.\" $OpenBSD: prebind.8,v 1.2 2007/05/31 19:19:39 jmc Exp $ -.\" -.\" Copyright (c) 2006 Dale Rahn <drahn@openbsd.org> -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: May 31 2007 $ -.Dt PREBIND 8 -.Os -.Sh NAME -.Nm prebind -.Nd cache symbol lookup information to speed up dynamic linking -.Sh SYNOPSIS -.Nm prebind -.Op Fl mv -.Op Ar file/dir ... -.Sh DESCRIPTION -.Nm -parses each of the specified files or directories and processes each ELF file -(ELF file found in the directory) and the associated -.Dv DT_NEEDED -libraries, -and writes symbol resolution hint information to each binary and library. -.Pp -.Nm -will add data to the programs specified and any libraries they reference -to speed up dynamic linking. -Since version information is stored in the libraries to validate the -prebind info, running -.Nm -on a subset of programs it was previously -run on will invalidate the prebind info for those excluded binaries. -The -.Fl m -option will preserve the old prebind info in any library if present. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl m -Merge into existing prebound libraries. -This prebinds new binaries without modifying or updating the libraries -(if prebind data is present), allowing old prebound binaries to continue -to use the old prebind data. -.It Fl v -Be verbose when running -.Nm : -prints out information about the file/library that is being processed. -.El -.Sh SEE ALSO -.Xr ld.so 1 , -.Xr prebind_strip 8 -.Sh STANDARDS -None -.Sh HISTORY -The -.Nm -utility first appeared in -.Ox 4.0 . -.Nm -is based loosely on Prelinking, however prelink removes the security -feature of libraries appearing in random order on each invocation, thus -it was incompatible with -.Ox Ns 's -goals. -.Nm -was written as an attempt to improve the speed of dynamic linking -without the penalty of loss of security features. -.Sh BUGS -Prebind uses a lot of memory depending on how many files/libraries -are being processed. -Handling of binaries where a required library has been removed is poor. diff --git a/libexec/ld.so/ldconfig/prebind.c b/libexec/ld.so/ldconfig/prebind.c index 3debfc7a1c7..b65368f9a92 100644 --- a/libexec/ld.so/ldconfig/prebind.c +++ b/libexec/ld.so/ldconfig/prebind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: prebind.c,v 1.10 2008/04/09 21:45:26 kurt Exp $ */ +/* $OpenBSD: prebind.c,v 1.11 2009/05/30 23:37:03 drahn Exp $ */ /* * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> * @@ -495,8 +495,6 @@ elf_load_object(void *pexe, const char *name) Elf_Dyn *dynp = NULL, *odynp; Elf_Ehdr *ehdr; Elf_Phdr *phdr; - const Elf_Sym *symt; - const char *strt; Elf_Addr lbase; Elf_Word *needed_list; int needed_cnt = 0, i; @@ -583,9 +581,6 @@ elf_load_object(void *pexe, const char *name) if (object->Dyn.info[DT_JMPREL]) map_to_virt(phdr, ehdr, lbase, &object->Dyn.info[DT_JMPREL]); - symt = object->dyn.symtab; - strt = object->dyn.strtab; - { Elf_Sym *sym; char *str; @@ -623,7 +618,6 @@ elf_load_object(void *pexe, const char *name) } bcopy(object->dyn.strtab, str, object->dyn.strsz); object->dyn.strtab = str; - strt = str; sym = calloc(object->nchains, sizeof(Elf_Sym)); if (sym == NULL) { @@ -634,7 +628,6 @@ elf_load_object(void *pexe, const char *name) bcopy(object->dyn.symtab, sym, object->nchains * sizeof(Elf_Sym)); object->dyn.symtab = sym; - symt = sym; if (object->dyn.relsz != 0) { rel = malloc(object->dyn.relsz); @@ -1097,7 +1090,12 @@ elf_find_symbol_rel(const char *name, struct elf_object *object, symcache[idx].sym = ref_sym; } } else { - printf("symbol not found %s\n", name); + /* It is not an error to have an undefined weak symbol */ + const Elf_Sym *sym; + sym = object->dyn.symtab + ELF_R_SYM(rel->r_info); + if (ELF_ST_BIND(sym->st_info) != STB_WEAK) { + printf("symbol not found %s\n", name); + } } } @@ -1161,7 +1159,12 @@ elf_find_symbol_rela(const char *name, struct elf_object *object, symcache[idx].sym = ref_sym; } } else { - printf("symbol not found %s\n", name); + /* It is not an error to have an undefined weak symbol */ + const Elf_Sym *sym; + sym = object->dyn.symtab + ELF_R_SYM(rela->r_info); + if (ELF_ST_BIND(sym->st_info) != STB_WEAK) { + printf("symbol not found %s\n", name); + } } } |