From: Ralf Baechle <ralf@uni-koblenz.de>
To: binutils@sourceware.cygnus.com, Mark Mitchell <mark@codesourcery.com>
Cc: linux@engr.sgi.com, linux-mips@fnet.fr, linux-mips@vger.rutgers.edu
Subject: R_MIPS_64 broken in relocateable links
Date: Wed, 13 Oct 1999 13:57:00 -0000 [thread overview]
Message-ID: <19991013213926.A1383@uni-koblenz.de> (raw)
The shell archive below is a testcase demonstrating a bug in handling
R_MIPS_64 relocations in 32-bit ELF broken for relocateable links.
The output objectfile will contain bad relocations like:
0000000000000014 l .text 0000000000000000 xxx
This seems to be caused by BFD temporarily adding 4 to the relocation's
address. It seem the fix is to undo this when copying R_MIPS_64
relocations to the output file?
Ralf
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-10-13 12:24 PDT by <ralf@cashcow>.
# Source directory was `/usr/people/ralf'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
# This format requires very little intelligence at unshar time.
# "if test", "echo", "mkdir", and "sed" may be needed.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 14 -rw-r--r-- nuke-ld-23/s1.s
# 48 -rw-r--r-- nuke-ld-23/s2.s
# 328 -rw-r--r-- nuke-ld-23/Makefile
#
echo=echo
if mkdir _sh92525; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= nuke-ld-23/s1.s ==============
if test ! -d 'nuke-ld-23'; then
$echo 'x -' 'creating directory' 'nuke-ld-23'
mkdir 'nuke-ld-23'
fi
if test -f 'nuke-ld-23/s1.s' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'nuke-ld-23/s1.s' '(file already exists)'
else
$echo 'x -' extracting 'nuke-ld-23/s1.s' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'nuke-ld-23/s1.s' &&
X .word 0x1234
SHAR_EOF
: || $echo 'restore of' 'nuke-ld-23/s1.s' 'failed'
fi
# ============= nuke-ld-23/s2.s ==============
if test -f 'nuke-ld-23/s2.s' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'nuke-ld-23/s2.s' '(file already exists)'
else
$echo 'x -' extracting 'nuke-ld-23/s2.s' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'nuke-ld-23/s2.s' &&
Xxxx: .dword something
Xsomething:
X .dword 0x789a
SHAR_EOF
: || $echo 'restore of' 'nuke-ld-23/s2.s' 'failed'
fi
# ============= nuke-ld-23/Makefile ==============
if test -f 'nuke-ld-23/Makefile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'nuke-ld-23/Makefile' '(file already exists)'
else
$echo 'x -' extracting 'nuke-ld-23/Makefile' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'nuke-ld-23/Makefile' &&
Xtarget=mips-linux-
XAS = $(target)as
XLD = $(target)ld
XOBJDUMP = $(target)objdump
X
Xall: broken.o
X
X.PHONY: broken.o
Xbroken.o: s1.o s2.o
X $(LD) -r -o $@ $^
X $(OBJDUMP) --full-content --section=.text $@
X $(OBJDUMP) --syms $@ | grep xxx
X $(OBJDUMP) --reloc $@
X
X.PHONY: clean distclean
Xclean distclean:
X -rm -f s1.o s2.o broken.o core
SHAR_EOF
: || $echo 'restore of' 'nuke-ld-23/Makefile' 'failed'
fi
rm -fr _sh92525
exit 0
next reply other threads:[~1999-10-13 13:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-13 13:57 Ralf Baechle [this message]
1999-10-13 20:49 ` Geoff Keating
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=19991013213926.A1383@uni-koblenz.de \
--to=ralf@uni-koblenz.de \
--cc=binutils@sourceware.cygnus.com \
--cc=linux-mips@fnet.fr \
--cc=linux-mips@vger.rutgers.edu \
--cc=linux@engr.sgi.com \
--cc=mark@codesourcery.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).