[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
no support for undefined weak 16-bit coff symbols
From: |
Jay Foad |
Subject: |
no support for undefined weak 16-bit coff symbols |
Date: |
Thu, 24 Apr 2008 11:25:45 +0100 |
I configured binutils 2.18 for z80-unknown-coff and tried this:
$ cat a.s
.weak foo
call foo
$ objdir-z80/gas/as-new -o a.o a.s
$ objdir-z80/binutils/objdump -tdr a.o
a.o: file format coff-z80
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 fake
File
[ 2](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
AUX scnlen 0x3 nreloc 1 nlnno 0
[ 4](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 6](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 8](sec 0)(fl 0x00)(ty 0)(scl 127) (nx 0) 0x00000000 foo
Disassembly of section .text:
00000000 <.text>:
0: cd 00 00 call 0x0000
1: r_imm16 foo
$ objdir-z80/ld/ld-new -o a a.o
a.o:fake:(.text+0x1): undefined reference to `foo'
It looks like bfd_coff_reloc16_get_value() doesn't know about
undefined weak symbols. This patch fixes the problem for me:
--- ../binutils-2.18/bfd/reloc16.c 2007-08-06 20:59:40.000000000 +0100
+++ bfd/reloc16.c 2008-04-24 11:10:17.000000000 +0100
@@ -76,6 +76,10 @@
else if (h != (struct bfd_link_hash_entry *) NULL
&& h->type == bfd_link_hash_common)
value = h->u.c.size;
+ else if (h != (struct bfd_link_hash_entry *) NULL
+ && h->type == bfd_link_hash_undefweak)
+ /* This is a GNU extension. */
+ value = 0;
else
{
if (!((*link_info->callbacks->undefined_symbol)
Thanks,
Jay.
- no support for undefined weak 16-bit coff symbols,
Jay Foad <=