aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-avr/relax-elf-flags-08.d
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2014-11-22 23:25:17 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2014-12-23 15:45:11 +0000
commit9d7b48dc6e8415e95f5228a6f66b414827eb0204 (patch)
treef39ae3d084904c79247eb69c55285809da8aad51 /ld/testsuite/ld-avr/relax-elf-flags-08.d
parenteac7440d805bec68f583db395aa42c38615daf14 (diff)
downloadgdb-9d7b48dc6e8415e95f5228a6f66b414827eb0204.zip
gdb-9d7b48dc6e8415e95f5228a6f66b414827eb0204.tar.gz
gdb-9d7b48dc6e8415e95f5228a6f66b414827eb0204.tar.bz2
AVR/ld: Propagate link-relax elf header flag correctly.
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.
Diffstat (limited to 'ld/testsuite/ld-avr/relax-elf-flags-08.d')
-rw-r--r--ld/testsuite/ld-avr/relax-elf-flags-08.d12
1 files changed, 12 insertions, 0 deletions
diff --git a/ld/testsuite/ld-avr/relax-elf-flags-08.d b/ld/testsuite/ld-avr/relax-elf-flags-08.d
new file mode 100644
index 0000000..0b2152a
--- /dev/null
+++ b/ld/testsuite/ld-avr/relax-elf-flags-08.d
@@ -0,0 +1,12 @@
+#name: AVR, check link-relax flag is clear final link (both inputs relaxable)
+#as: -mmcu=avrxmega2
+#ld: -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s -mlink-relax
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0x66, avr:102
+#... \ No newline at end of file