public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: slyich@gmail.com
To: libc-alpha@sourceware.org
Cc: Sergei Trofimovich <siarheit@google.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Roland McGrath <roland@hack.frob.com>
Subject: [PATCH] m68k: restore handling of R_68K_NONE in elf_machine_lazy_rel()
Date: Sat, 29 Oct 2016 13:48:00 -0000	[thread overview]
Message-ID: <20161029134801.15082-1-slyich@gmail.com> (raw)

From: Sergei Trofimovich <siarheit@google.com>

elf_machine_lazy_rel() used to support _NONE relocation
since it's initial merge:

  commit 01f3e03bcd992cc2917f5d228e763ef3d65e67ad
  Author: Roland McGrath <roland@gnu.org>
  Date:   Tue Feb 13 09:26:53 1996 +0000

Then it was (accidentally?) removed in

  commit 96e1bff2513873062233a13c7fd1eea57bb8db24
  Author: Roland McGrath <roland@gnu.org>
  Date:   Wed Jul 17 18:00:33 1996 +0000

I've noticed this error when tested ghc-HEAD dynamic executable
in qemu:

  ghc-m68k $ LD_DEBUG=reloc bash -x inplace/bin/ghc-stage2 --info
  ...
  5599:     relocation processing: .../compiler/stage2/build/libHSghc-8.1-ghc8.1.20161028.so (lazy)
  5599:     relocation processing: /lib/libncurses.so.6 (lazy)
  5599:     relocation processing: .../libraries/terminfo/dist-install/build/libHSterminfo-0.4.0.2-ghc8.1.20161028.so (lazy)
  5599:     relocation processing: .../libraries/haskeline/dist-install/build/libHShaskeline-0.7.2.3-ghc8.1.20161028.so (lazy)
  5599:     relocation processing: .../inplace/lib/bin/ghc-stage2 (lazy)
  .../inplace/lib/bin/ghc-stage2: error while loading shared libraries: unexpected PLT reloc type 0x00

ghc-HEAD used to work in March 2016.

  $ m68k-unknown-linux-gnu-objdump -rR inplace/lib/bin/ghc-stage2

  DYNAMIC RELOCATION RECORDS
  OFFSET   TYPE              VALUE
  00000000 R_68K_NONE        *ABS*
  00000000 R_68K_NONE        *ABS*
  ...

https://lists.debian.org/debian-68k/2003/02/msg00009.html
suggests it's somewhat known problem in bintuils.

I don't know yet how to force toolchain to binaries with
such relocations.

This change makes ghc-stage2 load and run fine on the following
toolchain version:

    gcc-5.4.0
    binutils-2.26.1
    glibc-2.23

CC: Andreas Schwab <schwab@linux-m68k.org>
CC: Roland McGrath <roland@hack.frob.com>

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
 sysdeps/m68k/dl-machine.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
index 41c179c..1b6b6a4 100644
--- a/sysdeps/m68k/dl-machine.h
+++ b/sysdeps/m68k/dl-machine.h
@@ -312,6 +312,8 @@ elf_machine_lazy_rel (struct link_map *map,
   Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
   if (ELF32_R_TYPE (reloc->r_info) == R_68K_JMP_SLOT)
     *reloc_addr += l_addr;
+  else if (ELF32_R_TYPE (reloc->r_info) == R_68K_NONE)
+    return;
   else
     _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
 }
-- 
2.10.1

             reply	other threads:[~2016-10-29 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-29 13:48 slyich [this message]
2016-10-29 15:37 ` Andreas Schwab
2016-10-29 16:15   ` Sergei Trofimovich
2016-10-29 17:11     ` Andreas Schwab
2016-10-30 10:13       ` Sergei Trofimovich
2016-10-30 11:05         ` Andreas Schwab
2016-11-08 23:56           ` Sergei Trofimovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161029134801.15082-1-slyich@gmail.com \
    --to=slyich@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=roland@hack.frob.com \
    --cc=schwab@linux-m68k.org \
    --cc=siarheit@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).