Remove the group section if all members are removed.
binutils/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR binutils/13180 * objcopy.c (is_strip_section_1): New. (is_strip_section): Use it. Remove the group section if all members are removed. binutils/testsuite/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR binutils/13180 * binutils-all/group-6.d: New. * binutils-all/group-6.s: Likewise. * binutils-all/objcopy.exp: Run group-6 for ELF targrts.
This commit is contained in:
parent
1a766c6843
commit
4c8e8a7ee0
@ -1,3 +1,10 @@
|
|||||||
|
2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR binutils/13180
|
||||||
|
* objcopy.c (is_strip_section_1): New.
|
||||||
|
(is_strip_section): Use it. Remove the group section if all
|
||||||
|
members are removed.
|
||||||
|
|
||||||
2011-09-08 Nick Clifton <nickc@redhat.com>
|
2011-09-08 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* po/ja.po: Updated Japanese translation.
|
* po/ja.po: Updated Japanese translation.
|
||||||
|
@ -925,10 +925,10 @@ group_signature (asection *group)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if a section is being removed. */
|
/* See if a non-group section is being removed. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
||||||
{
|
{
|
||||||
if (sections_removed || sections_copied)
|
if (sections_removed || sections_copied)
|
||||||
{
|
{
|
||||||
@ -955,10 +955,22 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See if a section is being removed. */
|
||||||
|
|
||||||
|
static bfd_boolean
|
||||||
|
is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
||||||
|
{
|
||||||
|
if (is_strip_section_1 (abfd, sec))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
if ((bfd_get_section_flags (abfd, sec) & SEC_GROUP) != 0)
|
if ((bfd_get_section_flags (abfd, sec) & SEC_GROUP) != 0)
|
||||||
{
|
{
|
||||||
asymbol *gsym;
|
asymbol *gsym;
|
||||||
const char *gname;
|
const char *gname;
|
||||||
|
asection *elt, *first;
|
||||||
|
|
||||||
/* PR binutils/3181
|
/* PR binutils/3181
|
||||||
If we are going to strip the group signature symbol, then
|
If we are going to strip the group signature symbol, then
|
||||||
@ -972,6 +984,19 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
|
|||||||
&& !is_specified_symbol (gname, keep_specific_htab))
|
&& !is_specified_symbol (gname, keep_specific_htab))
|
||||||
|| is_specified_symbol (gname, strip_specific_htab))
|
|| is_specified_symbol (gname, strip_specific_htab))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* Remove the group section if all members are removed. */
|
||||||
|
first = elt = elf_next_in_group (sec);
|
||||||
|
while (elt != NULL)
|
||||||
|
{
|
||||||
|
if (!is_strip_section_1 (abfd, elt))
|
||||||
|
return FALSE;
|
||||||
|
elt = elf_next_in_group (elt);
|
||||||
|
if (elt == first)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2011-09-15 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR binutils/13180
|
||||||
|
* binutils-all/group-6.d: New.
|
||||||
|
* binutils-all/group-6.s: Likewise.
|
||||||
|
|
||||||
|
* binutils-all/objcopy.exp: Run group-6 for ELF targrts.
|
||||||
|
|
||||||
2011-07-22 H.J. Lu <hongjiu.lu@intel.com>
|
2011-07-22 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* binutils-all/elfedit.exp: Run elfedit-4.
|
* binutils-all/elfedit.exp: Run elfedit-4.
|
||||||
|
9
binutils/testsuite/binutils-all/group-6.d
Normal file
9
binutils/testsuite/binutils-all/group-6.d
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#PROG: objcopy
|
||||||
|
#objcopy: --remove-section .text.foo
|
||||||
|
#name: copy removing all group member
|
||||||
|
#objdump: -fw
|
||||||
|
|
||||||
|
#...
|
||||||
|
.*: +file format .*
|
||||||
|
architecture: .*
|
||||||
|
#pass
|
4
binutils/testsuite/binutils-all/group-6.s
Normal file
4
binutils/testsuite/binutils-all/group-6.s
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.text
|
||||||
|
.byte 0
|
||||||
|
.section .text.foo,"axG",%progbits,foo,comdat
|
||||||
|
.byte 0
|
@ -937,6 +937,7 @@ if [is_elf_format] {
|
|||||||
objcopy_test_readelf "ELF group" group-3.s
|
objcopy_test_readelf "ELF group" group-3.s
|
||||||
objcopy_test_readelf "ELF group" group-4.s
|
objcopy_test_readelf "ELF group" group-4.s
|
||||||
run_dump_test "group-5"
|
run_dump_test "group-5"
|
||||||
|
run_dump_test "group-6"
|
||||||
run_dump_test "copy-1"
|
run_dump_test "copy-1"
|
||||||
run_dump_test "note-1"
|
run_dump_test "note-1"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user