This is the mail archive of the binutils@sources.redhat.com 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]

Partial linking interacts badly with N_WARNING and N_INDIR


I have identified two problems when you use partial linking
in conjunction with the N_INDIR and N_WARNING extensions for
a.out. I am configured for the pc532-netbsd target, but have no
reason to think is is not generic to other a.out targets and the
following examples use only pseudo-ops so should be testable with
other targets.

This is the file warn-ref.s:

	.stabs "This is a Warning about _warn_ref",30,0,0,0
	.stabs "_warn_ref",1,0,0,0

	.text
	.global _warn_ref

_warn_ref:
	.word 0



 $ pc532-netbsd-as -o warn-ref.o warn-ref.s
 $ pc532-netbsd-nm -a warn-ref.o | grep _warn_ref
00000000 - 00 0000 WARNING This is a Warning about _warn_ref
         U _warn_ref
00000000 T _warn_ref

# So far so good

 $ pc532-netbsd-ld -static -e _warn_ref -o warn-ref warn-ref.o
 $ pc532-netbsd-nm -a warn-ref | grep _warn_ref
00000000 - 00 0000 WARNING _warn_ref
         U _warn_ref
00001020 T _warn_ref
00001020 T _warn_ref

# The multiple definitions here seem harmless, but why has the
# WARNING message (symbol) changed. 

 $ pc532-netbsd-ld -x -r -o warn-ref.x warn-ref.o
 $ pc532-netbsd-nm -a warn-ref.x | grep _warn_ref
00000000 - 00 0000 WARNING _warn_ref
         U _warn_ref
00000000 T _warn_ref
00000000 T _warn_ref

# These multiple definitions are not harmless, but why has the WARNING
# message (symbol) changed?

 $ pc532-netbsd-ld -e _warn_ref -o warn-ref warn-ref.x
warn-ref.x(.text+0x0): multiple definition of `warn_ref'
warn-ref.x(.text+0x0): first defined here

# Problem!! Error caused by multiple definitions.

I also noted in an earlier message a problem with indirect
symbols. With the following _daylight.s file:

	.stabs "_daylight",10,0,0,0
	.stabs "__daylight",1,0,0,0


 $ pc532-netbsd-as -o _daylight.o _daylight.s
 $ pc532-netbsd-nm -a _daylight.o
00000000 I _daylight
         U __daylight

So far so good. But if I now run ld -r -x on it there are no symbols
left at all. The object file has nothing except the header.


Ian


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