mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
9d7b48dc6e
The AVR target has an elf header flag to indicate if an object was assembler ready for linker relaxation. If a partial link is performed then it is important that the link-relax flag in the output object is set correctly, otherwise, during the final link, we might try to perform linker relaxation on code that was not assembled suitably. As the link-relax elf header covers the entire object file we must be conservative when setting the flag in the output object, so, for a partial link, any input object that does not have the link-relax flag set will cause the output object to also not have the link-relax flag set. This conservative approach could be softened in future, we only need to disable the link relax flag if an input file is not marked link-relax ready, and the input file contains a relaxable section. However, I've left this optimisation for a later day. For the final link I've overloaded the use of the link-relax elf header flag, in a final executable, the flag now indicates if the executable was built with linker relaxation on or not. ld/ChangeLog: * emultempl/avrelf.em: Add include of elf/avr.h. (avr_finish): New function. (LDEMUL_FINISH): Added. ld/testsuite/ChangeLog: * ld-avr/relax-elf-flags-01.d: New file. * ld-avr/relax-elf-flags-02.d: New file. * ld-avr/relax-elf-flags-03.d: New file. * ld-avr/relax-elf-flags-04.d: New file. * ld-avr/relax-elf-flags-05.d: New file. * ld-avr/relax-elf-flags-06.d: New file. * ld-avr/relax-elf-flags-07.d: New file. * ld-avr/relax-elf-flags-08.d: New file. * ld-avr/relax-elf-flags-a.s: New file. * ld-avr/relax-elf-flags-b.s: New file.
12 lines
297 B
Makefile
12 lines
297 B
Makefile
#name: AVR, check link-relax flag is set on partial link
|
|
#as: -mmcu=avrxmega2
|
|
#ld: -r -mavrxmega2
|
|
#source: relax-elf-flags-a.s -mlink-relax
|
|
#source: relax-elf-flags-b.s -mlink-relax
|
|
#readelf: -h
|
|
#target: avr-*-*
|
|
|
|
ELF Header:
|
|
#...
|
|
Flags: 0xe6, avr:102, link-relax
|
|
#...
|