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]

2.10.91: A problem with LINK_ONCE_DISCARD sections on mipsel-linux


Hi,

 I am observing the following problem with 2.10.91 as of Sep 27th
configured for the mipsel-linux target.  When linking a shared object from
relocatables containing LINK_ONCE_DISCARD sections (typically C++
templates) and relocations against them, the linker crashes in the bfd on
the second occurance of a given section of such type.  The direct reason
of this is the following line of mips_elf_create_dynamic_relocation() in
elf32-mips.c: 

indx = elf_section_data (sec->output_section)->dynindx;

This happens, because subsequent LINK_ONCE_DISCARD sections are to be
discarded and thus have the special absolute section set as their
output_section and that section has its used_by_bfd field null.  All such
section symbols are marked local, so there is apparently no way to get at
the first, non-discarded section to set up the dynamic relocation right. 

 To repeat the failure just build dummy.S:

	.abicalls

	.section .gnu.linkonce.d.dummy,"aw"
	.int	0x76543210

	.data
	.int	.gnu.linkonce.d.dummy

with the following Makefile:

CC = gcc
CFLAGS = -pipe -O2 -fomit-frame-pointer -fPIC -g
LDFLAGS = -shared

all: dummy.so

dummy.so: first.os second.os
	$(CC) $(LDFLAGS) -o $@ $^

first.os second.os: dummy.S
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -f core *.so *.os

 Does anybody have an idea on how to fix this problem?  I'm out of
thoughts. :-(

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


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