a485e98ea0
Currently, section ordering differs a little for non-loaded reloc sections output by ld -emit-relocs or ld -r and that after passing such objects through objcopy. Not that it really matters, but it would be better for a simple objcopy to produce an unchanged output object file. Also, section headers are put somewhere in the middle of the non-loaded sections, again slightly differently for ld and objcopy. This patch fixes these discrepancies and puts section headers last, which is where gold puts them, and is where bfd_from_remote_memory wrongly assumed they will be found. bfd/ * elf.c (assign_file_positions_except_relocs): Move section header placement to.. (_bfd_elf_assign_file_positions_for_relocs): ..here. Make static. * elf-bfd.h (_bfd_elf_assign_file_positions_for_relocs): Delete. * elflink.c (bfd_elf_final_link): Don't call above function. gas/testsuite/ * gas/arm/got_prel.d: Adjust for changed section header placement. * gas/i386/ilp32/x86-64-size-1.d: Likewise. * gas/i386/ilp32/x86-64-size-3.d: Likewise. * gas/i386/ilp32/x86-64-size-5.d: Likewise. * gas/i386/ilp32/x86-64-unwind.d: Likewise. * gas/i386/size-1.d: Likewise. * gas/i386/size-3.d: Likewise. * gas/i386/x86-64-size-1.d: Likewise. * gas/i386/x86-64-size-3.d: Likewise. * gas/i386/x86-64-size-5.d: Likewise. * gas/i386/x86-64-unwind.d: Likewise. * gas/ia64/alias-ilp32.d: Likewise. * gas/ia64/alias.d: Likewise. * gas/ia64/group-1.d: Likewise. * gas/ia64/group-2.d: Likewise. * gas/ia64/secname-ilp32.d: Likewise. * gas/ia64/secname.d: Likewise. * gas/ia64/unwind-ilp32.d: Likewise. * gas/ia64/unwind.d: Likewise. * gas/mmix/bspec-1.d: Likewise. * gas/mmix/bspec-2.d: Likewise. * gas/mmix/byte-1.d: Likewise. * gas/mmix/loc-1.d: Likewise. * gas/mmix/loc-2.d: Likewise. * gas/mmix/loc-3.d: Likewise. * gas/mmix/loc-4.d: Likewise. * gas/mmix/loc-5.d: Likewise. * gas/tic6x/scomm-directive-4.d: Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-local-addend.d: Adjust for changed section header placement. * ld-aarch64/local-addend-r.d: Likewise. * ld-mmix/bspec1.d: Likewise. * ld-mmix/bspec2.d: Likewise. * ld-mmix/local1.d: Likewise. * ld-mmix/local3.d: Likewise. * ld-mmix/local5.d: Likewise. * ld-mmix/local7.d: Likewise. * ld-mmix/undef-3.d: Likewise. * ld-sh/sh64/crange3-cmpct.rd: Likewise. * ld-sh/sh64/crange3-media.rd: Likewise. * ld-sh/sh64/crangerel1.rd: Likewise. * ld-sh/sh64/crangerel2.rd: Likewise. * ld-tic6x/common.d: Likewise. * ld-tic6x/shlib-1.rd: Likewise. * ld-tic6x/shlib-1b.rd: Likewise. * ld-tic6x/shlib-1r.rd: Likewise. * ld-tic6x/shlib-1rb.rd: Likewise. * ld-tic6x/shlib-app-1.rd: Likewise. * ld-tic6x/shlib-app-1b.rd: Likewise. * ld-tic6x/shlib-app-1r.rd: Likewise. * ld-tic6x/shlib-app-1rb.rd: Likewise. * ld-tic6x/shlib-noindex.rd: Likewise. * ld-tic6x/static-app-1.rd: Likewise. * ld-tic6x/static-app-1b.rd: Likewise. * ld-tic6x/static-app-1r.rd: Likewise. * ld-tic6x/static-app-1rb.rd: Likewise. * ld-x86-64/ilp32-4.d: Likewise. * ld-x86-64/split-by-file-nacl.rd: Likewise. * ld-x86-64/split-by-file.rd: Likewise.
80 lines
3.3 KiB
R
80 lines
3.3 KiB
R
ELF Header:
|
|
+Magic: +7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
|
|
+Class: +ELF32
|
|
+Data: +2's complement, big endian
|
|
+Version: +1 \(current\)
|
|
+OS/ABI: +UNIX - System V
|
|
+ABI Version: +0
|
|
+Type: +EXEC \(Executable file\)
|
|
+Machine: +Renesas / SuperH SH
|
|
+Version: +0x1
|
|
+Entry point address: +0x10c4
|
|
+Start of program headers: +52 \(bytes into file\)
|
|
+Start of section headers: .*
|
|
+Flags: +0xa, sh5
|
|
+Size of this header: +52 \(bytes\)
|
|
+Size of program headers: +32 \(bytes\)
|
|
+Number of program headers: +2
|
|
+Size of section headers: +40 \(bytes\)
|
|
+Number of section headers: +8
|
|
+Section header string table index: 5
|
|
|
|
Section Headers:
|
|
+\[Nr\] Name +Type +Addr +Off +Size +ES Flg Lk Inf Al
|
|
+\[ 0\] +NULL +00000000 000000 000000 00 +0 +0 +0
|
|
+\[ 1\] \.init +PROGBITS +00001000 000080 000004 00 AXp +0 +0 +4
|
|
+\[ 2\] \.text +PROGBITS +00001004 000084 0000d8 00 AXp +0 +0 +4
|
|
+\[ 3\] \.stack +PROGBITS +00080000 000180 000004 00 +WA +0 +0 +1
|
|
+\[ 4\] \.cranges +LOUSER\+1 +00000000 000184 00003c 00 +W +0 +0 +1
|
|
+\[ 5\] \.shstrtab +STRTAB +.*
|
|
+\[ 6\] \.symtab +SYMTAB +.*
|
|
+\[ 7\] \.strtab +STRTAB +.*
|
|
Key to Flags:
|
|
#...
|
|
|
|
Symbol table '\.symtab' contains [0-9]+ entries:
|
|
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
|
|
.*: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +UND
|
|
.*: 00001000 +0 +SECTION +LOCAL +DEFAULT +1
|
|
.*: 00001004 +0 +SECTION +LOCAL +DEFAULT +2
|
|
.*: 00080000 +0 +SECTION +LOCAL +DEFAULT +3
|
|
.*: 00000000 +0 +SECTION +LOCAL +DEFAULT +4
|
|
.*: 00000000 +0 +FILE +LOCAL +DEFAULT +ABS .*
|
|
.*: 00001004 +0 +NOTYPE +LOCAL +DEFAULT +2 sec4
|
|
.*: 00000000 +0 +FILE +LOCAL +DEFAULT +ABS .*
|
|
.*: 000010a4 +0 +NOTYPE +LOCAL +DEFAULT +\[<other>: 4\] +2 start2
|
|
.*: 00000000 +0 +FILE +LOCAL +DEFAULT +ABS .*
|
|
.*: 000010bc +0 +NOTYPE +LOCAL +DEFAULT +2 sec3
|
|
.*: 000010c4 +0 +NOTYPE +GLOBAL +DEFAULT +\[<other>: 4\] +2 diversion
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +.* ___dtors
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +2 __bss_start
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +.* ___ctors_end
|
|
.*: 000010a4 +0 +NOTYPE +GLOBAL +DEFAULT +2 diversion2
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +.* ___ctors
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +2 _edata
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +2 _end
|
|
.*: 00001000 +0 +NOTYPE +GLOBAL +DEFAULT +\[<other>: 4\] +1 start
|
|
.*: 00080000 +0 +NOTYPE +GLOBAL +DEFAULT +3 _stack
|
|
.*: 00001160 +0 +NOTYPE +GLOBAL +DEFAULT +.* ___dtors_end
|
|
|
|
Hex dump of section '\.text':
|
|
0x00001004 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001014 6ff0fff0 6ff0fff0 cc00bd40 6ff0fff0 .*
|
|
0x00001024 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001034 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001044 6ff0fff0 6ff0fff0 6ff0fff0 cc00bd50 .*
|
|
0x00001054 cc0084c0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001064 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001074 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001084 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
|
|
0x00001094 6ff0fff0 6ff0fff0 6ff0fff0 cc0084d0 .*
|
|
0x000010a4 6ff0fff0 6ff0fff0 6ff0fff0 0000002a .*
|
|
0x000010b4 0000002b 00090009 00090009 00090000 .*
|
|
0x000010c4 e10f0009 00090009 00090009 00090009 .*
|
|
0x000010d4 00090009 0009e10e .*
|
|
|
|
Hex dump of section '\.cranges':
|
|
0x00000000 00001004 000000a0 00030000 10a40000 .*
|
|
0x00000010 000c0003 000010b0 00000008 00010000 .*
|
|
0x00000020 10b80000 00040002 000010bc 00000006 .*
|
|
0x00000030 00020000 10c40000 00180002 .*
|