From: Ralf Baechle <ralf@gnu.org>
To: binutils@sourceware.cygnus.com, Tim Hockin <thockin@cobaltnet.com>
Subject: MIPS/ELF linker
Date: Sat, 31 Jul 1999 14:49:00 -0000 [thread overview]
Message-ID: <19990731233150.Q12249@uni-koblenz.de> (raw)
Starting to play with the new MIPS backend from CVS:
[ralf@lappi binutils]$ cat x.s
.text
.globl __start
.weak hurz
__start:
la $2,hurz
[ralf@lappi binutils]$ mips-linux-as -O3 -KPIC -o x.o x.s
[ralf@lappi binutils]$ mips-linux-ld -o x x.o
x.o(.text+0x0): undefined reference to `hurz'
mips-linux-ld: x.o: .text+0x0: jump to stub routine which is not jal
mips-linux-ld: final link failed: Bad value
[ralf@lappi binutils]$
Misshandling error the weak undefined reference prevents any linking
against GNU libc since crti.o has a weak undefined reference against
__gmon_start__. A fix for elf32-mips.c is appended below.
The ``jump to stub routine which is not jal'' error message which is
obviously bogus as well is caused by mips_elf_calculate_relocation
returning without setting *require_jalxp to a defined value. A patch
to initialize the variable at the beginning of the function is also
part of the elf32-mips.c patch below.
A third bug is triggered by attempting to link an arbitrary program like
``main(){}'' against glibc 2.0. This results in a large number of
/usr/bin/mips-linux-ld: not enough GOT space for local GOT entries
messages. Obviously the calculation of the GOT size is wrong, but I'm
not yet shure what's the problem, so I just report this without a fix.
Bug #4:
[ralf@lappi bfd]$ cat y.s
.text
foo: la $2,foo
[ralf@lappi bfd]$ mips-linux-as -O3 -KPIC -o y.o y.s
[ralf@lappi bfd]$ mips-linux-ld -o y y.o
Segmentation fault (core dumped)
[ralf@lappi bfd]$
This is caused by g->global_gotsym in elf32-mips.c:7896
i = elf_hash_table (info)->dynsymcount - g->global_gotsym->dynindx;
being NULL; I also don't have a fix for this one.
Ralf
--- elf32-mips.c-cygnus Sat Jul 31 12:23:43 1999
+++ elf32-mips.c Sat Jul 31 23:02:33 1999
@@ -5791,6 +5791,9 @@
/* Assume that there will be no overflow. */
overflowed_p = false;
+ /* Assume no jalx is required */
+ *require_jalxp = false;
+
/* Figure out whether or not the symbol is local, and get the offset
used in the array of hash table entries. */
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -5870,6 +5873,12 @@
else
symbol = h->root.root.u.def.value;
}
+ else if ((h->root.root.type == bfd_link_hash_undefweak)
+ || (info->shared && !info->symbolic && !info->no_undefined))
+ {
+ sec = bfd_und_section_ptr;
+ symbol = 0;
+ }
else
{
(*info->callbacks->undefined_symbol)
next reply other threads:[~1999-07-31 14:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-07-31 14:49 Ralf Baechle [this message]
1999-07-31 15:26 ` Mark Mitchell
1999-07-31 16:23 ` Ralf Baechle
1999-07-31 16:41 ` Mark Mitchell
1999-07-31 16:46 ` Ralf Baechle
1999-08-01 14:01 ` Mark Mitchell
1999-08-03 9:29 ` Ian Lance Taylor
1999-08-03 9:46 ` Mark Mitchell
1999-08-03 9:48 ` Mark Mitchell
1999-08-01 14:03 ` Mark Mitchell
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=19990731233150.Q12249@uni-koblenz.de \
--to=ralf@gnu.org \
--cc=binutils@sourceware.cygnus.com \
--cc=thockin@cobaltnet.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).