Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so PR port-macppc/47464 - Old binutils genera...



details:   https://anonhg.NetBSD.org/src/rev/27e1ca0be10e
branches:  trunk
changeset: 353285:27e1ca0be10e
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu Apr 27 08:37:15 2017 +0000

description:
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.

diffstat:

 libexec/ld.elf_so/reloc.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r 47398520b7ad -r 27e1ca0be10e libexec/ld.elf_so/reloc.c
--- a/libexec/ld.elf_so/reloc.c Thu Apr 27 08:06:59 2017 +0000
+++ b/libexec/ld.elf_so/reloc.c Thu Apr 27 08:37:15 2017 +0000
@@ -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 @@
        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)));



Home | Main Index | Thread Index | Old Index