* [Patch] Prevent cloned symbols from being assigned to the wrong section
@ 2007-12-11 1:14 Catherine Moore
2007-12-11 1:32 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Catherine Moore @ 2007-12-11 1:14 UTC (permalink / raw)
To: binutils; +Cc: Catherine Moore
This patch fixes a problem that was showing up when the directive .set
was used to redefine a symbol. The symbol was being placed in the symbol
table instead of the absolute section. This eventually caused problems
when the executable was stripped.
The solution is to prevent the copying of the shndx in
elf_copy_private_symbol_data if the shndx is undefined.
Okay to commit?
Thanks,
Catherine
bfd/ChangeLog:
* elf.c (_bfd_elf_copy_private_symbol_data): Don't copy shndx if
the symbol's section is the undefined section.
gas/testsuite/ChangeLog:
elf/symtab.s: New test.
elf/symtab.d: New expected output.
elf/elf.exp: Run the new symbtab test.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.425
diff -p -r1.425 elf.c
*** bfd/elf.c 10 Dec 2007 23:44:23 -0000 1.425
--- bfd/elf.c 11 Dec 2007 00:12:55 -0000
*************** _bfd_elf_copy_private_symbol_data (bfd *
*** 6046,6051 ****
--- 6046,6052 ----
osym = elf_symbol_from (obfd, osymarg);
if (isym != NULL
+ && isym->internal_elf_sym.st_shndx != 0
&& osym != NULL
&& bfd_is_abs_section (isym->symbol.section))
{
Index: gas/testsuite/gas/elf/elf.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/elf.exp,v
retrieving revision 1.45
diff -p -r1.45 elf.exp
*** gas/testsuite/gas/elf/elf.exp 30 Nov 2007 23:47:55 -0000 1.45
--- gas/testsuite/gas/elf/elf.exp 11 Dec 2007 00:12:55 -0000
*************** if { ([istarget "*-*-*elf*"]
*** 109,114 ****
--- 109,115 ----
run_dump_test "section4"
run_elf_list_test "section5" "" "-al" "-SW" "| grep \"
\\\\.test\\\[0-9\\\]\""
run_dump_test "struct"
+ run_dump_test "symtab"
run_dump_test "symver"
run_elf_list_test "type" "" "" "-s" "| grep \"1 \\\[FONTC\\\]\""
run_dump_test "section6"
Index: gas/testsuite/gas/elf/symtab.d
===================================================================
RCS file: gas/testsuite/gas/elf/symtab.d
diff -N gas/testsuite/gas/elf/symtab.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gas/testsuite/gas/elf/symtab.d 11 Dec 2007 00:12:55 -0000
***************
*** 0 ****
--- 1,6 ----
+ #readelf: -s
+ #name: .set with expression
+
+ #...
+ .*ABS.*shift.*
+ #pass
Index: gas/testsuite/gas/elf/symtab.s
===================================================================
RCS file: gas/testsuite/gas/elf/symtab.s
diff -N gas/testsuite/gas/elf/symtab.s
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gas/testsuite/gas/elf/symtab.s 11 Dec 2007 00:12:55 -0000
***************
*** 0 ****
--- 1,5 ----
+ .text
+ .global foo
+ foo:
+ .set shift, 32
+ .set shift, shift - 1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] Prevent cloned symbols from being assigned to the wrong section
2007-12-11 1:14 [Patch] Prevent cloned symbols from being assigned to the wrong section Catherine Moore
@ 2007-12-11 1:32 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2007-12-11 1:32 UTC (permalink / raw)
To: Catherine Moore; +Cc: binutils
On Mon, Dec 10, 2007 at 08:14:20PM -0500, Catherine Moore wrote:
> bfd/ChangeLog:
>
> * elf.c (_bfd_elf_copy_private_symbol_data): Don't copy shndx if
> the symbol's section is the undefined section.
>
> gas/testsuite/ChangeLog:
>
> elf/symtab.s: New test.
> elf/symtab.d: New expected output.
> elf/elf.exp: Run the new symbtab test.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-11 1:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11 1:14 [Patch] Prevent cloned symbols from being assigned to the wrong section Catherine Moore
2007-12-11 1:32 ` 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).