When relaxing, update symbols at the very end of the section.
Symbols at the very end of a section were not being updated correctly when linker relaxation takes place due to the use of '<' instead of '<='. Added a couple of tests to cover this behaviour. bfd/ChangeLog: * elf32-avr.c (elf32_avr_relax_delete_bytes): Modify symbols located at the very end of the section. ld/ChangeLog: * ld/testsuite/ld-avr/relax-02.d: New file. * ld/testsuite/ld-avr/relax-02.s: New file. * ld/testsuite/ld-avr/relax-03.d: New file. * ld/testsuite/ld-avr/relax-03.s: New file.
This commit is contained in:
parent
5a3f568b70
commit
a12d0ffc72
7 changed files with 187 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-11-03 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* elf32-avr.c (elf32_avr_relax_delete_bytes): Modify symbols
|
||||
located at the very end of the section.
|
||||
|
||||
2014-11-03 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR binutils/17512
|
||||
|
|
|
@ -1883,7 +1883,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
|
|||
{
|
||||
if (isym->st_shndx == sec_shndx
|
||||
&& isym->st_value > addr
|
||||
&& isym->st_value < toaddr)
|
||||
&& isym->st_value <= toaddr)
|
||||
isym->st_value -= count;
|
||||
}
|
||||
}
|
||||
|
@ -1900,7 +1900,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
|
|||
|| sym_hash->root.type == bfd_link_hash_defweak)
|
||||
&& sym_hash->root.u.def.section == sec
|
||||
&& sym_hash->root.u.def.value > addr
|
||||
&& sym_hash->root.u.def.value < toaddr)
|
||||
&& sym_hash->root.u.def.value <= toaddr)
|
||||
{
|
||||
sym_hash->root.u.def.value -= count;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2014-11-03 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* testsuite/ld-avr/relax-02.d: New file.
|
||||
* testsuite/ld-avr/relax-02.s: New file.
|
||||
* testsuite/ld-avr/relax-03.d: New file.
|
||||
* testsuite/ld-avr/relax-03.s: New file.
|
||||
|
||||
2014-10-29 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* po/bg.po: Updated Bulgarian translation.
|
||||
|
|
64
ld/testsuite/ld-avr/relax-02.d
Normal file
64
ld/testsuite/ld-avr/relax-02.d
Normal file
|
@ -0,0 +1,64 @@
|
|||
#name: AVR relaxation, symbol at end of section.
|
||||
#as: -mmcu=avrxmega2 -mlink-relax
|
||||
#ld: -mavrxmega2 --relax
|
||||
#source: relax-02.s
|
||||
#objdump: -tzd
|
||||
#target: avr-*-*
|
||||
|
||||
.*: file format elf32-avr
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
00000000 l F \.text [0-9a-f]+ local_start
|
||||
0000000a l F \.text [0-9a-f]+ local_func_1
|
||||
00000014 l F \.text [0-9a-f]+ local_func_2
|
||||
0000001e l F \.text [0-9a-f]+ local_func_3
|
||||
00000032 l \.text 00000000 local_end_label
|
||||
00000028 g \.text 00000000 dest
|
||||
#...
|
||||
00000014 g F \.text [0-9a-f]+ func_2
|
||||
#...
|
||||
00000000 g F \.text [0-9a-f]+ _start
|
||||
00000032 g \.text 00000000 end_label
|
||||
0000000a g F \.text [0-9a-f]+ func_1
|
||||
#...
|
||||
0000001e g F \.text [0-9a-f]+ func_3
|
||||
|
||||
|
||||
|
||||
Disassembly of section \.text:
|
||||
|
||||
00000000 <_start>:
|
||||
0: 00 00 nop
|
||||
2: 00 00 nop
|
||||
4: 00 00 nop
|
||||
6: 00 00 nop
|
||||
8: 00 00 nop
|
||||
|
||||
0000000a <func_1>:
|
||||
a: 00 00 nop
|
||||
c: 00 00 nop
|
||||
e: 00 00 nop
|
||||
10: 00 00 nop
|
||||
12: 00 00 nop
|
||||
|
||||
00000014 <func_2>:
|
||||
14: 00 00 nop
|
||||
16: 08 c0 rjmp \.\+16 ; 0x28 <dest>
|
||||
18: 07 c0 rjmp \.\+14 ; 0x28 <dest>
|
||||
1a: 06 c0 rjmp \.\+12 ; 0x28 <dest>
|
||||
1c: 00 00 nop
|
||||
|
||||
0000001e <func_3>:
|
||||
1e: 00 00 nop
|
||||
20: 00 00 nop
|
||||
22: 00 00 nop
|
||||
24: 00 00 nop
|
||||
26: 00 00 nop
|
||||
|
||||
00000028 <dest>:
|
||||
28: 00 00 nop
|
||||
2a: 00 00 nop
|
||||
2c: 00 00 nop
|
||||
2e: 00 00 nop
|
||||
30: 00 00 nop
|
65
ld/testsuite/ld-avr/relax-02.s
Normal file
65
ld/testsuite/ld-avr/relax-02.s
Normal file
|
@ -0,0 +1,65 @@
|
|||
.section ".text", "ax",@progbits
|
||||
.global _start, dest, end_label
|
||||
.global func_1, func_2, func_3
|
||||
|
||||
_start:
|
||||
local_start:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
.type _start, @function
|
||||
.size _start, .-_start
|
||||
|
||||
.type local_start, @function
|
||||
.size local_start, .-local_start
|
||||
|
||||
func_1:
|
||||
local_func_1:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
.type func_1, @function
|
||||
.size func_1, .-func_1
|
||||
|
||||
.type local_func_1, @function
|
||||
.size local_func_1, .-local_func_1
|
||||
|
||||
func_2:
|
||||
local_func_2:
|
||||
nop
|
||||
jmp dest
|
||||
jmp dest
|
||||
jmp dest
|
||||
nop
|
||||
.type func_2, @function
|
||||
.size func_2, .-func_2
|
||||
|
||||
.type local_func_2, @function
|
||||
.size local_func_2, .-local_func_2
|
||||
|
||||
func_3:
|
||||
local_func_3:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
.type func_3, @function
|
||||
.size func_3, .-func_3
|
||||
|
||||
.type local_func_3, @function
|
||||
.size local_func_3, .-local_func_3
|
||||
|
||||
dest:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
end_label:
|
||||
local_end_label:
|
26
ld/testsuite/ld-avr/relax-03.d
Normal file
26
ld/testsuite/ld-avr/relax-03.d
Normal file
|
@ -0,0 +1,26 @@
|
|||
#name: AVR relaxation, single function in section.
|
||||
#as: -mmcu=avrxmega2 -mlink-relax
|
||||
#ld: -mavrxmega2 --relax
|
||||
#source: relax-03.s
|
||||
#objdump: -tzd
|
||||
#target: avr-*-*
|
||||
|
||||
.*: file format elf32-avr
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
00000000 l F .text [0-9a-f]+ local_start
|
||||
0000000a l .text 00000000 local_end_label
|
||||
#...
|
||||
00000000 g F \.text [0-9a-f]+ _start
|
||||
0000000a g \.text 00000000 end_label
|
||||
#...
|
||||
|
||||
Disassembly of section \.text:
|
||||
|
||||
00000000 <_start>:
|
||||
0: 00 00 nop
|
||||
2: 03 c0 rjmp \.\+6 ; 0xa <.*>
|
||||
4: 02 c0 rjmp \.\+4 ; 0xa <.*>
|
||||
6: 01 c0 rjmp \.\+2 ; 0xa <.*>
|
||||
8: 00 00 nop
|
18
ld/testsuite/ld-avr/relax-03.s
Normal file
18
ld/testsuite/ld-avr/relax-03.s
Normal file
|
@ -0,0 +1,18 @@
|
|||
.section ".text", "ax",@progbits
|
||||
.global _start, end_label
|
||||
|
||||
_start:
|
||||
local_start:
|
||||
nop
|
||||
jmp end_label
|
||||
jmp end_label
|
||||
jmp end_label
|
||||
nop
|
||||
.type _start, @function
|
||||
.size _start, .-_start
|
||||
|
||||
.type local_start, @function
|
||||
.size local_start, .-local_start
|
||||
|
||||
end_label:
|
||||
local_end_label:
|
Loading…
Add table
Reference in a new issue