This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: bfd is broken
On Fri, Jan 11, 2002 at 12:38:45PM -0500, Jakub Jelinek wrote:
> On Fri, Jan 11, 2002 at 09:34:15AM -0800, H . J . Lu wrote:
> > I tried. I couldn't get gcsec-1.c to fail on Linux/x86. I am wondering
> > how it failed for him.
>
> Executing on host: /usr/src/gcc/obj/gcc/xgcc -B/usr/src/gcc/obj/gcc/ /usr/src/gcc/gcc/testsuite/gcc.dg/special/gcsec-1.c -ffunction-sections -fdata-sections -Wl,--gc-sections -static -lm -o ./a.out (timeout = 300)
> collect2: ld terminated with signal 11 [Segmentation fault], core dumped
> compiler exited with status 1
Thanks. I am enclosing a patch.
>
> > > I was looking for a testcase where it failed for you, so if you think the
> > > above is what happens, no further need for it (though it should probably
> > > be added as a testcase for ld).
> >
> > I will see what I can do. I may write one which only runs on Linux/x86.
> > It should be good enough for catching breakage.
>
> Well, there are 3 ways how to write it.
> Either write a plain C testcase which will test SHF_MERGE only if gcc
> supports it, or gcc -S and sed the .s file to make plain .rodata sections
> .section ".rodata.str", "aMS", @progbits, 1
> or have testcase fully in assembly (in which case it will be for one arch
> only).
>
I don't see there are any testcases for merge. Let me think about it.
H.J.
---
2002-01-11 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_input_bfd): Revert the change made on
2002-01-07. Don't ask for the merged offset only if sec_info
is NULL instead.
--- bfd/elflink.h.merge Thu Jan 10 17:48:45 2002
+++ bfd/elflink.h Fri Jan 11 09:49:27 2002
@@ -6375,8 +6375,7 @@ elf_link_input_bfd (finfo, input_bfd)
isec = section_from_elf_index (input_bfd, isym->st_shndx);
if (isec
&& elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
- && (finfo->info->relocateable
- || ! (isec->flags & SEC_EXCLUDE))
+ && elf_section_data (isec)->sec_info != NULL
&& ELF_ST_TYPE (isym->st_info) != STT_SECTION)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,