aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-04-23 07:58:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-04-23 07:59:59 -0700
commitf6fe1ccd62e4492aabda6a9a9d12da438d0ebf2b (patch)
treea41818b68d4e2ece962519ffc0d61c5b2bc1fb8a /binutils
parent4ef9fb2f075daec3885c63aa2056075bdd94384b (diff)
downloadfsf-binutils-gdb-f6fe1ccd62e4492aabda6a9a9d12da438d0ebf2b.zip
fsf-binutils-gdb-f6fe1ccd62e4492aabda6a9a9d12da438d0ebf2b.tar.gz
fsf-binutils-gdb-f6fe1ccd62e4492aabda6a9a9d12da438d0ebf2b.tar.bz2
Don't change compressed input debug section names
Change compressed input debug section name for objdump is very confusing. But we need to change it for linker so that linker will consider the input section as a debug section. This patch delays section rename to elf_fake_sections for objcopy and avoids it for objdump. bfd/ PR binutils/18209 * bfd.c (bfd): Add is_linker_input. * elf.c (convert_debug_to_zdebug): New. (convert_zdebug_to_debug): Likewise. (_bfd_elf_make_section_from_shdr): Don't convert .debug_* to .zdebug_* here. Use convert_zdebug_to_debug. Set SEC_ELF_RENAME. (_bfd_elf_init_reloc_shdr): Pass a pointer to section name instead of a pointer to section. (elf_fake_sections): Rename the section name if SEC_ELF_RENAME is set. * section.c (SEC_ELF_RENAME): New. * bfd-in2.h: Regenerated. binutils/ PR binutils/18209 * objcopy.c (setup_section): Copy compress status. binutils/testsuite/ PR binutils/18209 * binutils-all/compress.exp: Replace dw2-3.W with dw2-3gabi.W on zlib-gabi output. * binutils-all/dw2-1.W: Convert section names to .zdebug_*. * binutils-all/dw2-3.W: Likewise. * binutils-all/objdump.W: Likewise. * binutils-all/dw2-3gabi.W: New file. ld/ PR binutils/18209 * ldfile.c (ldfile_try_open_bfd): Set is_linker_input to 1.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objcopy.c3
-rw-r--r--binutils/testsuite/ChangeLog10
-rw-r--r--binutils/testsuite/binutils-all/compress.exp2
-rw-r--r--binutils/testsuite/binutils-all/dw2-1.W4
-rw-r--r--binutils/testsuite/binutils-all/dw2-3.W6
-rw-r--r--binutils/testsuite/binutils-all/dw2-3gabi.W156
-rw-r--r--binutils/testsuite/binutils-all/objdump.W6
8 files changed, 183 insertions, 9 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 999d6d2..b0a5b1b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/18209
+ * objcopy.c (setup_section): Copy compress status.
+
2015-04-15 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index f7fc814..7f1bd76 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2929,6 +2929,9 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
/* Copy merge entity size. */
osection->entsize = isection->entsize;
+ /* Copy compress status. */
+ osection->compress_status = isection->compress_status;
+
/* This used to be mangle_section; we do here to avoid using
bfd_get_section_by_name since some formats allow multiple
sections with the same name. */
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 066aa7e..52daa35 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2015-04-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/18209
+ * binutils-all/compress.exp: Replace dw2-3.W with dw2-3gabi.W
+ on zlib-gabi output.
+ * binutils-all/dw2-1.W: Convert section names to .zdebug_*.
+ * binutils-all/dw2-3.W: Likewise.
+ * binutils-all/objdump.W: Likewise.
+ * binutils-all/dw2-3gabi.W: New file.
+
2015-04-20 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/i386/compressed-1b.d: Don't hardcode offset of
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 4d3b71c..8787e77 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -566,7 +566,7 @@ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "$testname"
send_log "$got\n"
}
-if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
+if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
fail "$testname"
} else {
pass "$testname"
diff --git a/binutils/testsuite/binutils-all/dw2-1.W b/binutils/testsuite/binutils-all/dw2-1.W
index 3811019..d70581b 100644
--- a/binutils/testsuite/binutils-all/dw2-1.W
+++ b/binutils/testsuite/binutils-all/dw2-1.W
@@ -1,7 +1,7 @@
.*dw2-1-compressed.o: file format .*
-Contents of the .debug_info section:
+Contents of the .z?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
@@ -30,7 +30,7 @@ Contents of the .debug_info section:
<50> DW_AT_encoding : 5 \(signed\)
<1><51>: Abbrev Number: 0
-Raw dump of debug contents of section .debug_line:
+Raw dump of debug contents of section .z?debug_line:
Offset: 0x0
Length: 62
diff --git a/binutils/testsuite/binutils-all/dw2-3.W b/binutils/testsuite/binutils-all/dw2-3.W
index 0d0fe6a..4e97a1c 100644
--- a/binutils/testsuite/binutils-all/dw2-3.W
+++ b/binutils/testsuite/binutils-all/dw2-3.W
@@ -1,7 +1,7 @@
.*: +file format .*
-Contents of the .debug_info section:
+Contents of the .zdebug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
@@ -56,7 +56,7 @@ Contents of the .debug_info section:
<9b> DW_AT_const_value : 2
<1><9c>: Abbrev Number: 0
-Contents of the .debug_abbrev section:
+Contents of the .zdebug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
@@ -110,7 +110,7 @@ Contents of the .debug_abbrev section:
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
-Raw dump of debug contents of section .debug_line:
+Raw dump of debug contents of section .z?debug_line:
Offset: 0x0
Length: 62
diff --git a/binutils/testsuite/binutils-all/dw2-3gabi.W b/binutils/testsuite/binutils-all/dw2-3gabi.W
new file mode 100644
index 0000000..0d0fe6a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw2-3gabi.W
@@ -0,0 +1,156 @@
+
+.*: +file format .*
+
+Contents of the .debug_info section:
+
+ Compilation Unit @ offset 0x0:
+ Length: 0x5e \(32-bit\)
+ Version: 2
+ Abbrev Offset: 0x0
+ Pointer Size: 4
+ <0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
+ <c> DW_AT_stmt_list : 0x0
+ <10> DW_AT_high_pc : 0x4
+ <14> DW_AT_low_pc : 0x0
+ <18> DW_AT_name : file1.txt
+ <22> DW_AT_producer : GNU C 3.3.3
+ <2e> DW_AT_language : 1 \(ANSI C\)
+ <1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
+ <30> DW_AT_external : 1
+ <31> DW_AT_decl_file : 1
+ <32> DW_AT_decl_line : 2
+ <33> DW_AT_name : func_cu1
+ <3c> DW_AT_type : <0x85>
+ <40> DW_AT_low_pc : 0x0
+ <44> DW_AT_high_pc : 0x4
+ <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
+ <1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
+ <4b> DW_AT_name : int1
+ <50> DW_AT_byte_size : 4
+ <51> DW_AT_encoding : 5 \(signed\)
+ <1><52>: Abbrev Number: 4 \(DW_TAG_const_type\)
+ <53> DW_AT_type : <0x4a>
+ <1><57>: Abbrev Number: 5 \(DW_TAG_variable\)
+ <58> DW_AT_name : one
+ <5c> DW_AT_type : <0x52>
+ <60> DW_AT_const_value : 1
+ <1><61>: Abbrev Number: 0
+ Compilation Unit @ offset 0x62:
+ Length: 0x37 \(32-bit\)
+ Version: 2
+ Abbrev Offset: 0x45
+ Pointer Size: 4
+ <0><6d>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
+ <6e> DW_AT_name : file1.txt
+ <78> DW_AT_producer : GNU C 3.3.3
+ <84> DW_AT_language : 1 \(ANSI C\)
+ <1><85>: Abbrev Number: 2 \(DW_TAG_base_type\)
+ <86> DW_AT_name : int2
+ <8b> DW_AT_byte_size : 4
+ <8c> DW_AT_encoding : 5 \(signed\)
+ <1><8d>: Abbrev Number: 3 \(DW_TAG_const_type\)
+ <8e> DW_AT_type : <0x85>
+ <1><92>: Abbrev Number: 4 \(DW_TAG_variable\)
+ <93> DW_AT_name : two
+ <97> DW_AT_type : <0x8d>
+ <9b> DW_AT_const_value : 2
+ <1><9c>: Abbrev Number: 0
+
+Contents of the .debug_abbrev section:
+
+ Number TAG \(0x0\)
+ 1 DW_TAG_compile_unit \[has children\]
+ DW_AT_stmt_list DW_FORM_data4
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_name DW_FORM_string
+ DW_AT_producer DW_FORM_string
+ DW_AT_language DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+ 2 DW_TAG_subprogram \[no children\]
+ DW_AT_external DW_FORM_flag
+ DW_AT_decl_file DW_FORM_data1
+ DW_AT_decl_line DW_FORM_data1
+ DW_AT_name DW_FORM_string
+ DW_AT_type DW_FORM_ref_addr
+ DW_AT_low_pc DW_FORM_addr
+ DW_AT_high_pc DW_FORM_addr
+ DW_AT_frame_base DW_FORM_block1
+ DW_AT value: 0 DW_FORM value: 0
+ 3 DW_TAG_base_type \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+ 4 DW_TAG_const_type \[no children\]
+ DW_AT_type DW_FORM_ref4
+ DW_AT value: 0 DW_FORM value: 0
+ 5 DW_TAG_variable \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_type DW_FORM_ref4
+ DW_AT_const_value DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+ Number TAG \(0x45\)
+ 1 DW_TAG_compile_unit \[has children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_producer DW_FORM_string
+ DW_AT_language DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+ 2 DW_TAG_base_type \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_byte_size DW_FORM_data1
+ DW_AT_encoding DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+ 3 DW_TAG_const_type \[no children\]
+ DW_AT_type DW_FORM_ref4
+ DW_AT value: 0 DW_FORM value: 0
+ 4 DW_TAG_variable \[no children\]
+ DW_AT_name DW_FORM_string
+ DW_AT_type DW_FORM_ref4
+ DW_AT_const_value DW_FORM_data1
+ DW_AT value: 0 DW_FORM value: 0
+
+Raw dump of debug contents of section .debug_line:
+
+ Offset: 0x0
+ Length: 62
+ DWARF Version: 2
+ Prologue Length: 35
+ Minimum Instruction Length: 1
+ Initial value of 'is_stmt': 1
+ Line Base: 1
+ Line Range: 1
+ Opcode Base: 16
+
+ Opcodes:
+ Opcode 1 has 0 args
+ Opcode 2 has 1 args
+ Opcode 3 has 1 args
+ Opcode 4 has 1 args
+ Opcode 5 has 1 args
+ Opcode 6 has 0 args
+ Opcode 7 has 0 args
+ Opcode 8 has 0 args
+ Opcode 9 has 1 args
+ Opcode 10 has 0 args
+ Opcode 11 has 0 args
+ Opcode 12 has 1 args
+ Opcode 13 has 0 args
+ Opcode 14 has 0 args
+ Opcode 15 has 0 args
+
+ The Directory Table is empty.
+
+ The File Name Table \(offset 0x1f\):
+ Entry Dir Time Size Name
+ 1 0 0 0 file1.txt
+
+ Line Number Statements:
+ \[0x0000002d\] Extended opcode 2: set Address to 0x0
+ \[0x00000034\] Advance Line by 3 to 4
+ \[0x00000036\] Copy
+ \[0x00000037\] Copy
+ \[0x00000038\] Extended opcode 2: set Address to 0x4
+ \[0x0000003f\] Extended opcode 1: End of Sequence
+
+
diff --git a/binutils/testsuite/binutils-all/objdump.W b/binutils/testsuite/binutils-all/objdump.W
index 48dde48..a5379d0 100644
--- a/binutils/testsuite/binutils-all/objdump.W
+++ b/binutils/testsuite/binutils-all/objdump.W
@@ -1,7 +1,7 @@
.*dw2-compressed.o: file format .*
-Contents of the .debug_info section:
+Contents of the .z?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
@@ -30,7 +30,7 @@ Contents of the .debug_info section:
<50> DW_AT_encoding : 5 \(signed\)
<1><51>: Abbrev Number: 0
-Raw dump of debug contents of section .debug_line:
+Raw dump of debug contents of section .z?debug_line:
Offset: 0x0
Length: 62
@@ -74,7 +74,7 @@ Raw dump of debug contents of section .debug_line:
\[0x.*\] Extended opcode 1: End of Sequence
-Contents of the .debug_abbrev section:
+Contents of the .zdebug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]