aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-05-29 07:07:21 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-05-29 07:07:21 +0000
commit11701589a86095161ed1739192cd80a0a94ca868 (patch)
tree503e8d304fd6e280a9f06d0fc9ad4dc82f59675f
parentfcac911af1c9b3f79e93e0317d594dc99794c39a (diff)
downloadgdb-11701589a86095161ed1739192cd80a0a94ca868.zip
gdb-11701589a86095161ed1739192cd80a0a94ca868.tar.gz
gdb-11701589a86095161ed1739192cd80a0a94ca868.tar.bz2
bfd/
* elf.c (assign_file_positions_for_load_sections): Adjust pre-section gaps based on VMA and P_VADDR instead of LMA and P_PADDR addresses. binutils/testsuite/ * binutils-all/objcopy.exp: Call KEEP_DEBUG_SYMBOLS_AND_TEST_COPY. (keep_debug_symbols_and_test_copy): New function. (test5, test6): New variables.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c4
-rw-r--r--binutils/testsuite/ChangeLog6
-rw-r--r--binutils/testsuite/binutils-all/objcopy.exp36
4 files changed, 49 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4fb2a0b..e980d90 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-29 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * elf.c (assign_file_positions_for_load_sections): Adjust pre-section
+ gaps based on VMA and P_VADDR instead of LMA and P_PADDR addresses.
+
2008-05-28 Alan Modra <amodra@bigpond.net.au>
* elf32-spu.c (spu_elf_object_p): New function.
diff --git a/bfd/elf.c b/bfd/elf.c
index 005f8f6..37a1501 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4371,12 +4371,12 @@ assign_file_positions_for_load_sections (bfd *abfd,
&& ((this_hdr->sh_flags & SHF_TLS) == 0
|| p->p_type == PT_TLS))))
{
- bfd_signed_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
+ bfd_signed_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
if (adjust < 0)
{
(*_bfd_error_handler)
- (_("%B: section %A lma 0x%lx overlaps previous sections"),
+ (_("%B: section %A vma 0x%lx overlaps previous sections"),
abfd, sec, (unsigned long) sec->lma);
adjust = 0;
}
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index e7cc69a..79aa219 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-29 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * binutils-all/objcopy.exp: Call KEEP_DEBUG_SYMBOLS_AND_TEST_COPY.
+ (keep_debug_symbols_and_test_copy): New function.
+ (test5, test6): New variables.
+
2008-03-27 Cary Coutant <ccoutant@google.com>
* binutils-all/ar.exp: Add thin archive tests.
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 8c232d0..fe87f62 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -681,10 +681,40 @@ proc strip_executable_with_saving_a_symbol { prog flags test } {
pass $test
}
+# Test keeping only debug symbols of an executable
+
+proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } {
+ global NM
+ global NMFLAGS
+
+ remote_download build tmpdir/copyprog tmpdir/striprog
+ if [is_remote host] {
+ set copyfile [remote_download host tmpdir/striprog]
+ } else {
+ set copyfile tmpdir/striprog
+ }
+
+ set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"]
+ if ![string match "" $exec_output] {
+ fail $test1
+ return
+ }
+ pass $test1
+
+ set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"]
+ if ![string match "" $exec_output] {
+ fail $test2
+ return
+ }
+ pass $test2
+}
+
set test1 "simple objcopy of executable"
set test2 "run objcopy of executable"
set test3 "run stripped executable"
set test4 "run stripped executable with saving a symbol"
+set test5 "keep only debug data"
+set test6 "simple objcopy of debug data"
switch [copy_setup] {
"1" {
@@ -695,17 +725,23 @@ switch [copy_setup] {
untested $test2
untested $test3
untested $test4
+ untested $test5
+ untested $test6
}
"3" {
copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
unsupported $test2
unsupported $test3
unsupported $test4
+ unsupported $test5
+ unsupported $test6
}
"0" {
copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2"
strip_executable "$STRIP" "$STRIPFLAGS" "$test3"
strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4"
+ keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test5" \
+ "$OBJCOPY" "$OBJCOPYFLAGS" "$test6"
}
}