aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-01-13 15:41:00 +0000
committerJakub Jelinek <jakub@redhat.com>2004-01-13 15:41:00 +0000
commitf0312d395b830bea0f17a279ad1a6d8009c46db0 (patch)
treea950546984735fab6bc1283fe5b739ab696b9909 /binutils
parent6bdafbeb578394fd9fff6c45b15f71dd5678190b (diff)
downloadgdb-f0312d395b830bea0f17a279ad1a6d8009c46db0.zip
gdb-f0312d395b830bea0f17a279ad1a6d8009c46db0.tar.gz
gdb-f0312d395b830bea0f17a279ad1a6d8009c46db0.tar.bz2
* objcopy.c: Include elf-bfd.h.
(is_strip_section): Don't strip debugging sections if STRIP_NONDEBUG. (setup_section): If STRIP_NONDEBUG make SEC_ALLOC sections ~(SEC_LOAD | SEC_HAS_CONTENTS) and on ELF targets also SHT_NOBITS. * objcopy.c (copy_section): Free relpp if relcount == 0.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog10
-rw-r--r--binutils/objcopy.c12
2 files changed, 21 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 708682f..bd4883a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,13 @@
+2004-01-12 Jakub Jelinek <jakub@redhat.com>
+
+ * objcopy.c: Include elf-bfd.h.
+ (is_strip_section): Don't strip debugging sections if
+ STRIP_NONDEBUG.
+ (setup_section): If STRIP_NONDEBUG make SEC_ALLOC sections
+ ~(SEC_LOAD | SEC_HAS_CONTENTS) and on ELF targets also SHT_NOBITS.
+
+ * objcopy.c (copy_section): Free relpp if relcount == 0.
+
2004-01-12 Ian Lance Taylor <ian@wasabisystems.com>
* stabs.c (parse_stab_argtypes): Handle g++ ABI version 3 names.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 1d71d9d..d31eb8f 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -28,6 +28,7 @@
#include "budbg.h"
#include "filenames.h"
#include "fnmatch.h"
+#include "elf-bfd.h"
#include <sys/stat.h>
/* A list of symbols to explicitly strip out, or to keep. A linked
@@ -776,7 +777,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
return FALSE;
}
- return strip_symbols == STRIP_NONDEBUG ? TRUE : FALSE;
+ return FALSE;
}
/* Choose which symbol entries to copy; put the result in OSYMS.
@@ -1909,6 +1910,13 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
if (p != NULL && p->set_flags)
flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC));
+ else if (strip_symbols == STRIP_NONDEBUG && (flags & SEC_ALLOC) != 0)
+ {
+ flags &= ~(SEC_HAS_CONTENTS | SEC_LOAD);
+ if (obfd->xvec->flavour == bfd_target_elf_flavour)
+ elf_section_type (osection) = SHT_NOBITS;
+ }
+
if (!bfd_set_section_flags (obfd, osection, flags))
{
err = _("flags");
@@ -2029,6 +2037,8 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
}
bfd_set_reloc (obfd, osection, relcount == 0 ? NULL : relpp, relcount);
+ if (relcount == 0)
+ free (relpp);
}
isection->_cooked_size = isection->_raw_size;