This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sh64 partial link not resolving datalabel refs

We have a problem when trying to do a partial link for
sh64 target.

Here's a cut-down example:

$ cat x.s
        .global xxx
xxx:    .long 1, 2, 3

$ cat y.s
        .global yyy
        .long datalabel xxx

$ sh64-elf-as -abi=32 -isa=shmedia -o x.o x.s
$ ar r libx.a x.o
$ sh64-elf-as -abi=32 -isa=shmedia -o y.o y.s
$ sh64-elf-ld -mshelf32 -r y.o -L. -lx -o y
$ sh64-elf-nm y
         U xxx
00000000 D yyy

The problem is that xxx remains undefined after the
partial link, but it should have been pulled in from libx.a.
The problem only occurs when the "datalabel" operator is used.

The misbehaviour appears to be because during a partial link,
symbols marked STT_DATALABEL are simply renamed on input,
e.g. "xxx" is renamed "xxx DL"  (in bfd/elf32-sh64.c,
sh64_elf_add_symbol_hook).  This does not match the
name in the definition (in x.o in libx.a), and so x.o
is not added to the link.   "xxx DL" remains unresolved, and
on output it is renamed back to "xxx".

I'd like to work out a fix for this, but I'm really
not sure what to do: I can't see how this partial link
behaviour is supposed to work.
Any hints or ideas would be most welcome.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]