Subject: ld -x
To: None <tech-toolchain@NetBSD.ORG>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-toolchain
Date: 05/18/1998 21:20:45
I have finally got binutils to be useable for a.out machines, but I still
have one problem...
In bsd.lib.mk, all rules has a line
@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
Why do we have those?
My problem is that when I have assembled a file containing something like
the sparc source below
.data
_initialized:
.word 0
.text
.global _init
_init:
ld [%l7+_initialized],%o1
using the '-k' flag (i.e. as pic code), I get a error when doing
ld -x -r
a.o(.text+0x0): reloc refers to symbol `initialized' which is not
being output
I have no problem with our current ld, but if you look closer on the
object file output by it, you will see that it has invented a new symbol:
ulysses> nm a.o
00000000 T _init
00000008 d a.o._initialized
So what is the right thing to do? I have built my NetBSD port on the sunos
version, so I think I have the same behavior as sunos (but I may of course
have broken something.) I quick glance on the code showed no obvious way
to get the new ld to behave the same way as our old one, without doing
evil thing to the general a.out backend (beside, I think my behavior is
more consistent with what the man page says: "Discard all local symbols
in the input files.")
My suggestion is to remove the ld -x business in bsd.lib.mk, but I'm sure
someone will tell me that's a stupid thing to do...
/Krister