* bfd is broken
@ 2002-01-10 20:21 H . J . Lu
2002-01-10 20:55 ` H . J . Lu
2002-01-10 23:10 ` Geoff Keating
0 siblings, 2 replies; 15+ messages in thread
From: H . J . Lu @ 2002-01-10 20:21 UTC (permalink / raw)
To: binutils; +Cc: geoffk
This patch
http://sources.redhat.com/ml/binutils/2002-01/msg00094.html
breaks bfd which causes "make check" to fild in ld:
Running /home/hjl/work/gnu/src/binutils/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp
...
FAIL: bootstrap
FAIL: bootstrap with strip
FAIL: bootstrap with --static
FAIL: bootstrap with --traditional-format
FAIL: bootstrap with --no-keep-memory
I am using gcc 2.96-99 from Red Hat and binutils is configured with
# ../configure --enable-64-bit-bfd --enable-targets=all
on Linux/x86.
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-10 20:21 bfd is broken H . J . Lu
@ 2002-01-10 20:55 ` H . J . Lu
2002-01-10 23:10 ` Geoff Keating
1 sibling, 0 replies; 15+ messages in thread
From: H . J . Lu @ 2002-01-10 20:55 UTC (permalink / raw)
To: binutils; +Cc: geoffk
On Thu, Jan 10, 2002 at 06:27:30PM -0800, H . J . Lu wrote:
> This patch
>
> http://sources.redhat.com/ml/binutils/2002-01/msg00094.html
>
> breaks bfd which causes "make check" to fild in ld:
>
> Running /home/hjl/work/gnu/src/binutils/binutils/ld/testsuite/ld-bootstrap/bootstrap.exp
> ...
> FAIL: bootstrap
> FAIL: bootstrap with strip
> FAIL: bootstrap with --static
> FAIL: bootstrap with --traditional-format
> FAIL: bootstrap with --no-keep-memory
>
> I am using gcc 2.96-99 from Red Hat and binutils is configured with
>
> # ../configure --enable-64-bit-bfd --enable-targets=all
>
> on Linux/x86.
Hi Geoffrey,
If you can show me how to reproduce it, I will look into it. A .o file
should be fine.
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-10 20:21 bfd is broken H . J . Lu
2002-01-10 20:55 ` H . J . Lu
@ 2002-01-10 23:10 ` Geoff Keating
2002-01-10 23:34 ` H . J . Lu
1 sibling, 1 reply; 15+ messages in thread
From: Geoff Keating @ 2002-01-10 23:10 UTC (permalink / raw)
To: hjl; +Cc: binutils
The configuration I used to test the original patch was x86 Red Hat
Linux 7 with all updates applied, using the Red Hat GNUPro 00r1
compiler, without special configure flags; and the bootstrap test
passed. When I got your message I ran a build with the toplevel
binutils CVS tree, the latest bundled compiler gcc-2.96-85, and your two
special configure flags; and the bootstrap test still passed. In fact
all tests pass or xfail.
I wouldn't expect SEC_EXCLUDE to be used much when building ld. How
did you determine that it was my patch?
Can you be more specific about your system?
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-10 23:10 ` Geoff Keating
@ 2002-01-10 23:34 ` H . J . Lu
2002-01-11 4:43 ` Jakub Jelinek
0 siblings, 1 reply; 15+ messages in thread
From: H . J . Lu @ 2002-01-10 23:34 UTC (permalink / raw)
To: Geoff Keating; +Cc: binutils
On Thu, Jan 10, 2002 at 08:54:51PM -0800, Geoff Keating wrote:
>
> The configuration I used to test the original patch was x86 Red Hat
> Linux 7 with all updates applied, using the Red Hat GNUPro 00r1
> compiler, without special configure flags; and the bootstrap test
> passed. When I got your message I ran a build with the toplevel
> binutils CVS tree, the latest bundled compiler gcc-2.96-85, and your two
> special configure flags; and the bootstrap test still passed. In fact
> all tests pass or xfail.
>
> I wouldn't expect SEC_EXCLUDE to be used much when building ld. How
> did you determine that it was my patch?
Backing out your patch fixes ld. Can you tell me how to reproduce your
bug? The .c/.o/.s files are fine.
>
> Can you be more specific about your system?
>
Some string constances have bogus values. The only differences are I
am using gcc 2.96-99 and binutils 2.11.92.0.12.3.
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-10 23:34 ` H . J . Lu
@ 2002-01-11 4:43 ` Jakub Jelinek
2002-01-11 9:34 ` H . J . Lu
2002-01-11 12:42 ` Geoff Keating
0 siblings, 2 replies; 15+ messages in thread
From: Jakub Jelinek @ 2002-01-11 4:43 UTC (permalink / raw)
To: H . J . Lu; +Cc: Geoff Keating, binutils
On Thu, Jan 10, 2002 at 11:03:13PM -0800, H . J . Lu wrote:
> On Thu, Jan 10, 2002 at 08:54:51PM -0800, Geoff Keating wrote:
> >
> > The configuration I used to test the original patch was x86 Red Hat
> > Linux 7 with all updates applied, using the Red Hat GNUPro 00r1
> > compiler, without special configure flags; and the bootstrap test
> > passed. When I got your message I ran a build with the toplevel
> > binutils CVS tree, the latest bundled compiler gcc-2.96-85, and your two
> > special configure flags; and the bootstrap test still passed. In fact
> > all tests pass or xfail.
> >
> > I wouldn't expect SEC_EXCLUDE to be used much when building ld. How
> > did you determine that it was my patch?
>
> Backing out your patch fixes ld. Can you tell me how to reproduce your
> bug? The .c/.o/.s files are fine.
I'd really like to see testcase, but looking at Geoff patch I see what can
be wrong: _bfd_merged_section_offset needs to be called even if
(isec->flags & SEC_EXCLUDE), provided SEC_EXCLUDE has been added because of
_cooked_size 0.
E.g. if a.s has:
.section ".rodata.str1.1", "aMS", @progbits, 1
.LC1: .asciiz "foobar"
.LC2: .asciiz "bogusstr"
and b.s has:
.section ".rodata.str1.1", "aMS", @progbits, 1
.LC3: .asciiz "bar"
.LC4: .asciiz "str"
then b.o's .rodata.str1.1 section will be SEC_EXCLUDE, but .LC3 needs to be
translated to .LC1 + 3 and .LC4 to .LC2 + 5.
Jakub
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 4:43 ` Jakub Jelinek
@ 2002-01-11 9:34 ` H . J . Lu
2002-01-11 9:38 ` Jakub Jelinek
2002-01-11 12:42 ` Geoff Keating
1 sibling, 1 reply; 15+ messages in thread
From: H . J . Lu @ 2002-01-11 9:34 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Geoff Keating, binutils
On Fri, Jan 11, 2002 at 10:59:10AM +0100, Jakub Jelinek wrote:
> On Thu, Jan 10, 2002 at 11:03:13PM -0800, H . J . Lu wrote:
> > On Thu, Jan 10, 2002 at 08:54:51PM -0800, Geoff Keating wrote:
> > >
> > > The configuration I used to test the original patch was x86 Red Hat
> > > Linux 7 with all updates applied, using the Red Hat GNUPro 00r1
> > > compiler, without special configure flags; and the bootstrap test
> > > passed. When I got your message I ran a build with the toplevel
> > > binutils CVS tree, the latest bundled compiler gcc-2.96-85, and your two
> > > special configure flags; and the bootstrap test still passed. In fact
> > > all tests pass or xfail.
> > >
> > > I wouldn't expect SEC_EXCLUDE to be used much when building ld. How
> > > did you determine that it was my patch?
> >
> > Backing out your patch fixes ld. Can you tell me how to reproduce your
> > bug? The .c/.o/.s files are fine.
>
> I'd really like to see testcase, but looking at Geoff patch I see what can
> be wrong: _bfd_merged_section_offset needs to be called even if
> (isec->flags & SEC_EXCLUDE), provided SEC_EXCLUDE has been added because of
> _cooked_size 0.
>
> E.g. if a.s has:
> .section ".rodata.str1.1", "aMS", @progbits, 1
> .LC1: .asciiz "foobar"
> .LC2: .asciiz "bogusstr"
>
> and b.s has:
> .section ".rodata.str1.1", "aMS", @progbits, 1
> .LC3: .asciiz "bar"
> .LC4: .asciiz "str"
>
> then b.o's .rodata.str1.1 section will be SEC_EXCLUDE, but .LC3 needs to be
> translated to .LC1 + 3 and .LC4 to .LC2 + 5.
I believe it is what happened in my case. May I suggest to back out
the broken patch? We will fix it later when a testcase is provided?
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 9:34 ` H . J . Lu
@ 2002-01-11 9:38 ` Jakub Jelinek
2002-01-11 9:43 ` H . J . Lu
0 siblings, 1 reply; 15+ messages in thread
From: Jakub Jelinek @ 2002-01-11 9:38 UTC (permalink / raw)
To: H . J . Lu; +Cc: Geoff Keating, binutils
On Fri, Jan 11, 2002 at 09:22:22AM -0800, H . J . Lu wrote:
> > E.g. if a.s has:
> > .section ".rodata.str1.1", "aMS", @progbits, 1
> > .LC1: .asciiz "foobar"
> > .LC2: .asciiz "bogusstr"
> >
> > and b.s has:
> > .section ".rodata.str1.1", "aMS", @progbits, 1
> > .LC3: .asciiz "bar"
> > .LC4: .asciiz "str"
> >
> > then b.o's .rodata.str1.1 section will be SEC_EXCLUDE, but .LC3 needs to be
> > translated to .LC1 + 3 and .LC4 to .LC2 + 5.
>
> I believe it is what happened in my case. May I suggest to back out
> the broken patch? We will fix it later when a testcase is provided?
Geoff sais where is the testcase (gcc testsuite gcsec-1.c).
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).
Jakub
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 9:38 ` Jakub Jelinek
@ 2002-01-11 9:43 ` H . J . Lu
2002-01-11 9:58 ` Jakub Jelinek
0 siblings, 1 reply; 15+ messages in thread
From: H . J . Lu @ 2002-01-11 9:43 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Geoff Keating, binutils
On Fri, Jan 11, 2002 at 12:24:51PM -0500, Jakub Jelinek wrote:
> On Fri, Jan 11, 2002 at 09:22:22AM -0800, H . J . Lu wrote:
> > > E.g. if a.s has:
> > > .section ".rodata.str1.1", "aMS", @progbits, 1
> > > .LC1: .asciiz "foobar"
> > > .LC2: .asciiz "bogusstr"
> > >
> > > and b.s has:
> > > .section ".rodata.str1.1", "aMS", @progbits, 1
> > > .LC3: .asciiz "bar"
> > > .LC4: .asciiz "str"
> > >
> > > then b.o's .rodata.str1.1 section will be SEC_EXCLUDE, but .LC3 needs to be
> > > translated to .LC1 + 3 and .LC4 to .LC2 + 5.
> >
> > I believe it is what happened in my case. May I suggest to back out
> > the broken patch? We will fix it later when a testcase is provided?
>
> Geoff sais where is the testcase (gcc testsuite gcsec-1.c).
I tried. I couldn't get gcsec-1.c to fail on Linux/x86. I am wondering
how it failed for him.
> 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.
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 9:43 ` H . J . Lu
@ 2002-01-11 9:58 ` Jakub Jelinek
2002-01-11 11:48 ` H . J . Lu
2002-01-11 13:54 ` H . J . Lu
0 siblings, 2 replies; 15+ messages in thread
From: Jakub Jelinek @ 2002-01-11 9:58 UTC (permalink / raw)
To: H . J . Lu; +Cc: Geoff Keating, binutils
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
> > 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).
Jakub
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 9:58 ` Jakub Jelinek
@ 2002-01-11 11:48 ` H . J . Lu
2002-01-11 13:54 ` H . J . Lu
1 sibling, 0 replies; 15+ messages in thread
From: H . J . Lu @ 2002-01-11 11:48 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Geoff Keating, binutils
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,
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 4:43 ` Jakub Jelinek
2002-01-11 9:34 ` H . J . Lu
@ 2002-01-11 12:42 ` Geoff Keating
2002-01-11 15:38 ` Jakub Jelinek
2002-01-14 9:23 ` [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken) Jakub Jelinek
1 sibling, 2 replies; 15+ messages in thread
From: Geoff Keating @ 2002-01-11 12:42 UTC (permalink / raw)
To: jakub; +Cc: hjl, binutils
> Date: Fri, 11 Jan 2002 10:59:10 +0100
> From: Jakub Jelinek <jakub@redhat.com>
> Cc: Geoff Keating <geoffk@redhat.com>, binutils@sources.redhat.com
> Reply-To: Jakub Jelinek <jakub@redhat.com>
>
> On Thu, Jan 10, 2002 at 11:03:13PM -0800, H . J . Lu wrote:
> > On Thu, Jan 10, 2002 at 08:54:51PM -0800, Geoff Keating wrote:
> > >
> > > The configuration I used to test the original patch was x86 Red Hat
> > > Linux 7 with all updates applied, using the Red Hat GNUPro 00r1
> > > compiler, without special configure flags; and the bootstrap test
> > > passed. When I got your message I ran a build with the toplevel
> > > binutils CVS tree, the latest bundled compiler gcc-2.96-85, and your two
> > > special configure flags; and the bootstrap test still passed. In fact
> > > all tests pass or xfail.
> > >
> > > I wouldn't expect SEC_EXCLUDE to be used much when building ld. How
> > > did you determine that it was my patch?
> >
> > Backing out your patch fixes ld. Can you tell me how to reproduce your
> > bug? The .c/.o/.s files are fine.
>
> I'd really like to see testcase, but looking at Geoff patch I see what can
> be wrong: _bfd_merged_section_offset needs to be called even if
> (isec->flags & SEC_EXCLUDE), provided SEC_EXCLUDE has been added because of
> _cooked_size 0.
>
> E.g. if a.s has:
> .section ".rodata.str1.1", "aMS", @progbits, 1
> .LC1: .asciiz "foobar"
> .LC2: .asciiz "bogusstr"
>
> and b.s has:
> .section ".rodata.str1.1", "aMS", @progbits, 1
> .LC3: .asciiz "bar"
> .LC4: .asciiz "str"
>
> then b.o's .rodata.str1.1 section will be SEC_EXCLUDE, but .LC3 needs to be
> translated to .LC1 + 3 and .LC4 to .LC2 + 5.
That makes sense. Why do we set SEC_EXCLUDE on this section, if it
has size 0 anyway and so wouldn't take up any space in the output?
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 9:58 ` Jakub Jelinek
2002-01-11 11:48 ` H . J . Lu
@ 2002-01-11 13:54 ` H . J . Lu
1 sibling, 0 replies; 15+ messages in thread
From: H . J . Lu @ 2002-01-11 13:54 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Geoff Keating, binutils
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
>
> > > 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 have a testcase in assembly. But it is quite tricky. You have to
use as from 2.11.92.0.12.3 to see the failure. I don't know how useful
the testcase is.
H.J.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: bfd is broken
2002-01-11 12:42 ` Geoff Keating
@ 2002-01-11 15:38 ` Jakub Jelinek
2002-01-14 9:23 ` [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken) Jakub Jelinek
1 sibling, 0 replies; 15+ messages in thread
From: Jakub Jelinek @ 2002-01-11 15:38 UTC (permalink / raw)
To: Geoff Keating; +Cc: hjl, binutils
On Fri, Jan 11, 2002 at 11:13:58AM -0800, Geoff Keating wrote:
> That makes sense. Why do we set SEC_EXCLUDE on this section, if it
> has size 0 anyway and so wouldn't take up any space in the output?
Because bfd ATM is not able to set _cooked_size = 0 (_cooked_size == 0
means use _raw_size). It really needs to be changed soon, but it will mean
changing a lot of code.
Jakub
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken)
2002-01-11 12:42 ` Geoff Keating
2002-01-11 15:38 ` Jakub Jelinek
@ 2002-01-14 9:23 ` Jakub Jelinek
2002-01-15 2:21 ` Alan Modra
1 sibling, 1 reply; 15+ messages in thread
From: Jakub Jelinek @ 2002-01-14 9:23 UTC (permalink / raw)
To: Geoff Keating; +Cc: hjl, binutils
On Fri, Jan 11, 2002 at 11:13:58AM -0800, Geoff Keating wrote:
> That makes sense. Why do we set SEC_EXCLUDE on this section, if it
> has size 0 anyway and so wouldn't take up any space in the output?
Here is a fix:
It worked before I changed ->stab_info, ->merge_info into ->sec_info_type,
->sec_merge (_bfd_merge_sections was clearing merge_info if it encountered
something (e.g. GC) deleted one of the SEC_MERGE sections), but now it just
cleared it and didn't know there is section info type encoded somewhere.
One solution would be to always check both that
sec_info_type == ELF_INFO_TYPE_MERGE && sec_info != NULL
but IMHO just clearing sec_info_type in this case is better.
Bootstrapped on i386-redhat-linux, no failures, fixes gcsec-1.c.
Ok to commit?
2002-01-14 Jakub Jelinek <jakub@redhat.com>
* elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
* elf.c (merge_sections_remove_hook): New function.
(_bfd_elf_merge_sections): Pass it as 3rd argument to
_bfd_merge_sections.
* libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
* libbfd.h: Rebuilt.
* merge.c (_bfd_merge_sections): Add remove_hook argument.
Call remove_hook if a SEC_EXCLUDE section is encountered.
--- bfd/elflink.h.jj Mon Jan 14 17:02:47 2002
+++ bfd/elflink.h Mon Jan 14 17:44:31 2002
@@ -6375,8 +6375,6 @@ 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_ST_TYPE (isym->st_info) != STT_SECTION)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,
--- bfd/elf.c.jj Mon Jan 14 17:02:46 2002
+++ bfd/elf.c Mon Jan 14 18:17:59 2002
@@ -53,6 +53,7 @@ static boolean swap_out_syms PARAMS ((bf
static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *));
static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type));
static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+static void merge_sections_remove_hook PARAMS ((bfd *, asection *));
static void elf_fake_sections PARAMS ((bfd *, asection *, PTR));
static void set_group_contents PARAMS ((bfd *, asection *, PTR));
static boolean assign_section_numbers PARAMS ((bfd *));
@@ -770,6 +771,20 @@ bfd_elf_generic_reloc (abfd,
return bfd_reloc_continue;
}
\f
+/* Make sure sec_info_type is cleared if sec_info is cleared too. */
+
+static void
+merge_sections_remove_hook (abfd, sec)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+{
+ struct bfd_elf_section_data *sec_data;
+
+ sec_data = elf_section_data (sec);
+ BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
+ sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
+}
+
/* Finish SHF_MERGE section merging. */
boolean
@@ -780,7 +795,8 @@ _bfd_elf_merge_sections (abfd, info)
if (!is_elf_hash_table (info))
return false;
if (elf_hash_table (info)->merge_info)
- _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info);
+ _bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
+ merge_sections_remove_hook);
return true;
}
\f
--- bfd/libbfd-in.h.jj Mon Jan 14 17:02:48 2002
+++ bfd/libbfd-in.h Mon Jan 14 17:50:16 2002
@@ -478,7 +478,7 @@ extern boolean _bfd_merge_section
/* Attempt to merge SEC_MERGE sections. */
extern boolean _bfd_merge_sections
- PARAMS ((bfd *, PTR));
+ PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
/* Write out a merged section. */
--- bfd/libbfd.h.jj Mon Jan 14 17:02:48 2002
+++ bfd/libbfd.h Mon Jan 14 17:50:28 2002
@@ -483,7 +483,7 @@ extern boolean _bfd_merge_section
/* Attempt to merge SEC_MERGE sections. */
extern boolean _bfd_merge_sections
- PARAMS ((bfd *, PTR));
+ PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
/* Write out a merged section. */
--- bfd/merge.c.jj Fri Oct 5 13:02:24 2001
+++ bfd/merge.c Mon Jan 14 17:53:10 2002
@@ -771,9 +771,10 @@ alloc_failure:
with _bfd_merge_section. */
boolean
-_bfd_merge_sections (abfd, xsinfo)
+_bfd_merge_sections (abfd, xsinfo, remove_hook)
bfd *abfd ATTRIBUTE_UNUSED;
PTR xsinfo;
+ void (*remove_hook) PARAMS((bfd *, asection *));
{
struct sec_merge_info *sinfo;
@@ -792,7 +793,11 @@ _bfd_merge_sections (abfd, xsinfo)
/* Record the sections into the hash table. */
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
if (secinfo->sec->flags & SEC_EXCLUDE)
- *secinfo->psecinfo = NULL;
+ {
+ *secinfo->psecinfo = NULL;
+ if (remove_hook)
+ (*remove_hook) (abfd, secinfo->sec);
+ }
else if (! record_section (sinfo, secinfo))
break;
Jakub
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken)
2002-01-14 9:23 ` [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken) Jakub Jelinek
@ 2002-01-15 2:21 ` Alan Modra
0 siblings, 0 replies; 15+ messages in thread
From: Alan Modra @ 2002-01-15 2:21 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Geoff Keating, hjl, binutils
On Mon, Jan 14, 2002 at 05:23:06PM +0100, Jakub Jelinek wrote:
>
> * elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
> * elf.c (merge_sections_remove_hook): New function.
> (_bfd_elf_merge_sections): Pass it as 3rd argument to
> _bfd_merge_sections.
> * libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
> * libbfd.h: Rebuilt.
> * merge.c (_bfd_merge_sections): Add remove_hook argument.
> Call remove_hook if a SEC_EXCLUDE section is encountered.
OK.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2002-01-14 23:08 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-10 20:21 bfd is broken H . J . Lu
2002-01-10 20:55 ` H . J . Lu
2002-01-10 23:10 ` Geoff Keating
2002-01-10 23:34 ` H . J . Lu
2002-01-11 4:43 ` Jakub Jelinek
2002-01-11 9:34 ` H . J . Lu
2002-01-11 9:38 ` Jakub Jelinek
2002-01-11 9:43 ` H . J . Lu
2002-01-11 9:58 ` Jakub Jelinek
2002-01-11 11:48 ` H . J . Lu
2002-01-11 13:54 ` H . J . Lu
2002-01-11 12:42 ` Geoff Keating
2002-01-11 15:38 ` Jakub Jelinek
2002-01-14 9:23 ` [PATCH] Fix GC and SHF_MERGE interaction (was Re: bfd is broken) Jakub Jelinek
2002-01-15 2:21 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).