This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: _bfd_elf_merge_symbol tidy
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Tue, 26 Mar 2013 17:31:55 +1030
- Subject: Re: _bfd_elf_merge_symbol tidy
- References: <20130325055926 dot GY18331 at bubble dot grove dot modra dot org> <20130325061120 dot GC18331 at bubble dot grove dot modra dot org>
On Mon, Mar 25, 2013 at 04:41:20PM +1030, Alan Modra wrote:
> @@ -1620,9 +1626,8 @@ _bfd_elf_add_default_symbol (bfd *abfd,
> actually going to define an indirect symbol. */
> type_change_ok = FALSE;
> size_change_ok = FALSE;
> - sec = *psec;
> - if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
> - NULL, NULL, &hi, &skip, &override,
> + if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, &value,
> + &hi, poldbfd, NULL, NULL, &skip, &override,
> &type_change_ok, &size_change_ok))
> return FALSE;
>
> @@ -1729,9 +1734,8 @@ nondefault:
> /* Once again, merge with any existing symbol. */
> type_change_ok = FALSE;
> size_change_ok = FALSE;
> - sec = *psec;
> - if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, value,
> - NULL, NULL, &hi, &skip, &override,
> + if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, &value,
> + &hi, NULL, NULL, NULL, &skip, &override,
> &type_change_ok, &size_change_ok))
> return FALSE;
>
Oops, the above change let a changed "sec" from the first
_bfd_elf_merge_symbol call to reach the second call. I should know
better than to just test on x86_64 which has a whole lot of elf tests
disabled.
* elflink.c (_bfd_elf_add_default_symbol): Preserve section
over _bfd_elf_merge_symbol calls.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.483
diff -u -p -r1.483 elflink.c
--- bfd/elflink.c 26 Mar 2013 06:08:14 -0000 1.483
+++ bfd/elflink.c 26 Mar 2013 06:56:55 -0000
@@ -1600,6 +1600,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
bfd_boolean override;
char *p;
size_t len, shortlen;
+ asection *tmp_sec;
/* If this symbol has a version, and it is the default version, we
create an indirect symbol from the default name to the fully
@@ -1626,7 +1627,8 @@ _bfd_elf_add_default_symbol (bfd *abfd,
actually going to define an indirect symbol. */
type_change_ok = FALSE;
size_change_ok = FALSE;
- if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, &value,
+ tmp_sec = sec;
+ if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
&hi, poldbfd, NULL, NULL, &skip, &override,
&type_change_ok, &size_change_ok))
return FALSE;
@@ -1734,7 +1736,8 @@ nondefault:
/* Once again, merge with any existing symbol. */
type_change_ok = FALSE;
size_change_ok = FALSE;
- if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &sec, &value,
+ tmp_sec = sec;
+ if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value,
&hi, NULL, NULL, NULL, &skip, &override,
&type_change_ok, &size_change_ok))
return FALSE;
--
Alan Modra
Australia Development Lab, IBM