Module Name: src Committed By: uwe Date: Thu Apr 27 08:37:15 UTC 2017
Modified Files: src/libexec/ld.elf_so: reloc.c Log Message: PR port-macppc/47464 - Old binutils generated bogus zero-sized COPY relocations for _SDA_BASE_ and _SDA2_BASE_ that happened to work by accident. They no longer happen to work when old binaries are run on newer systems. Explicitly ignore these bogus relocations. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/libexec/ld.elf_so/reloc.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/reloc.c diff -u src/libexec/ld.elf_so/reloc.c:1.109 src/libexec/ld.elf_so/reloc.c:1.110 --- src/libexec/ld.elf_so/reloc.c:1.109 Tue Jun 14 13:06:41 2016 +++ src/libexec/ld.elf_so/reloc.c Thu Apr 27 08:37:15 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: reloc.c,v 1.109 2016/06/14 13:06:41 christos Exp $ */ +/* $NetBSD: reloc.c,v 1.110 2017/04/27 08:37:15 uwe Exp $ */ /* * Copyright 1996 John D. Polstra. @@ -39,7 +39,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: reloc.c,v 1.109 2016/06/14 13:06:41 christos Exp $"); +__RCSID("$NetBSD: reloc.c,v 1.110 2017/04/27 08:37:15 uwe Exp $"); #endif /* not lint */ #include <err.h> @@ -73,6 +73,22 @@ _rtld_do_copy_relocation(const Obj_Entry const Elf_Sym *srcsym = NULL; Obj_Entry *srcobj; + if (__predict_false(size == 0)) { +#if defined(__powerpc__) && !defined(__LP64) /* PR port-macppc/47464 */ + if (strcmp(name, "_SDA_BASE_") == 0 + || strcmp(name, "_SDA2_BASE_") == 0) + { + rdbg(("COPY %s %s --> ignoring old binutils bug", + dstobj->path, name)); + return 0; + } +#endif +#if 0 /* shall we warn? */ + xwarnx("%s: zero size COPY relocation for \"%s\"", + dstobj->path, name); +#endif + } + for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next) { srcsym = _rtld_symlook_obj(name, hash, srcobj, 0, _rtld_fetch_ventry(dstobj, ELF_R_SYM(rela->r_info)));