aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-01-08 22:07:48 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-02-25 23:19:11 +0000
commitbac13f5a4c05ed88d7c4639c37ad01bb7e305419 (patch)
tree09b0947686793b41a08ba78d766f6a0d6ec6bce3 /ld
parent137c83d69fad77677cc818593f9399caa777a0c5 (diff)
downloadgdb-bac13f5a4c05ed88d7c4639c37ad01bb7e305419.zip
gdb-bac13f5a4c05ed88d7c4639c37ad01bb7e305419.tar.gz
gdb-bac13f5a4c05ed88d7c4639c37ad01bb7e305419.tar.bz2
AVR/ld: Use .avr.prop data during linker relaxation.
Make use of the data held within the .avr.prop section during linker relaxation in order to maintain the properties of the .org and .align directives. In relation to the .align directives, if enough bytes are deleted before a .align directive then the alignment can be moved while still maintaining the alignment requirement. bfd/ChangeLog: * elf32-avr.c (struct elf_avr_section_data): New structure. (struct avr_relax_info): New structure. (elf_avr_new_section_hook): New function. (struct elf_avr_section_data): Add relax_info. (get_avr_relax_info): New function. (init_avr_relax_info): New function. (elf32_avr_relax_delete_bytes): Find next property record before deleting bytes. When deleting don't move bytes beyond the next property record. (avr_elf32_assign_records_to_section): New function. (avr_property_record_compare): New function. (avr_load_all_property_sections): New function. (elf32_avr_relax_section): Load property data. After relaxing the section, move any .align directives that have enough deleted bytes before them. (bfd_elf32_new_section_hook): Define. ld/testsuite/ChangeLog: * ld-avr/avr-prop-1.d: New file. * ld-avr/avr-prop-1.s: New file. * ld-avr/avr-prop-2.d: New file. * ld-avr/avr-prop-2.s: New file. * ld-avr/avr-prop-3.d: New file. * ld-avr/avr-prop-3.s: New file. * ld-avr/avr-prop-4.d: New file. * ld-avr/avr-prop-4.s: New file.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-avr/avr-prop-1.d10
-rw-r--r--ld/testsuite/ld-avr/avr-prop-1.s7
-rw-r--r--ld/testsuite/ld-avr/avr-prop-2.d12
-rw-r--r--ld/testsuite/ld-avr/avr-prop-2.s13
-rw-r--r--ld/testsuite/ld-avr/avr-prop-3.d10
-rw-r--r--ld/testsuite/ld-avr/avr-prop-3.s8
-rw-r--r--ld/testsuite/ld-avr/avr-prop-4.d10
-rw-r--r--ld/testsuite/ld-avr/avr-prop-4.s8
9 files changed, 89 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 9313705..3d7fcba 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2015-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ld-avr/avr-prop-1.d: New file.
+ * ld-avr/avr-prop-1.s: New file.
+ * ld-avr/avr-prop-2.d: New file.
+ * ld-avr/avr-prop-2.s: New file.
+ * ld-avr/avr-prop-3.d: New file.
+ * ld-avr/avr-prop-3.s: New file.
+ * ld-avr/avr-prop-4.d: New file.
+ * ld-avr/avr-prop-4.s: New file.
+
2015-02-25 Oleg Endo <olegendo@gcc.gnu.org>
* ld-sh/arch/arch_expected.txt: Regenerate.
diff --git a/ld/testsuite/ld-avr/avr-prop-1.d b/ld/testsuite/ld-avr/avr-prop-1.d
new file mode 100644
index 0000000..0c4ddc4
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-1.d
@@ -0,0 +1,10 @@
+#name: AVR .avr.prop, single .org test.
+#as: -mmcu=avrxmega2 -mlink-relax
+#ld: -mavrxmega2 --relax
+#source: avr-prop-1.s
+#nm: -n
+#target: avr-*-*
+
+#...
+00000020 T dest
+#...
diff --git a/ld/testsuite/ld-avr/avr-prop-1.s b/ld/testsuite/ld-avr/avr-prop-1.s
new file mode 100644
index 0000000..a287d3e
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-1.s
@@ -0,0 +1,7 @@
+ .text
+ .global _start, dest
+_start:
+ CALL dest
+ .org 0x20
+dest:
+ nop
diff --git a/ld/testsuite/ld-avr/avr-prop-2.d b/ld/testsuite/ld-avr/avr-prop-2.d
new file mode 100644
index 0000000..a45443e
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-2.d
@@ -0,0 +1,12 @@
+#name: AVR .avr.prop, multiple .org test.
+#as: -mmcu=avrxmega2 -mlink-relax
+#ld: -mavrxmega2 --relax
+#source: avr-prop-2.s
+#nm: -n
+#target: avr-*-*
+
+#...
+00000010 T label1
+00000020 T label2
+00000030 T dest
+#...
diff --git a/ld/testsuite/ld-avr/avr-prop-2.s b/ld/testsuite/ld-avr/avr-prop-2.s
new file mode 100644
index 0000000..a36eb18
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-2.s
@@ -0,0 +1,13 @@
+ .text
+ .global _start, label1, label2, dest
+_start:
+ CALL dest
+ .org 0x10
+label1:
+ CALL dest
+ .org 0x20
+label2:
+ CALL dest
+ .org 0x30
+dest:
+ nop
diff --git a/ld/testsuite/ld-avr/avr-prop-3.d b/ld/testsuite/ld-avr/avr-prop-3.d
new file mode 100644
index 0000000..0e1e271
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-3.d
@@ -0,0 +1,10 @@
+#name: AVR .avr.prop, single .align test.
+#as: -mmcu=avrxmega2 -mlink-relax
+#ld: -mavrxmega2 --relax
+#source: avr-prop-3.s
+#nm: -n
+#target: avr-*-*
+
+#...
+00000008 T dest
+#...
diff --git a/ld/testsuite/ld-avr/avr-prop-3.s b/ld/testsuite/ld-avr/avr-prop-3.s
new file mode 100644
index 0000000..bf66a45
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-3.s
@@ -0,0 +1,8 @@
+ .text
+ .global _start, dest
+_start:
+ CALL dest
+ CALL dest
+ .align 3
+dest:
+ NOP
diff --git a/ld/testsuite/ld-avr/avr-prop-4.d b/ld/testsuite/ld-avr/avr-prop-4.d
new file mode 100644
index 0000000..42a42c1
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-4.d
@@ -0,0 +1,10 @@
+#name: AVR .avr.prop, realign .align test.
+#as: -mmcu=avrxmega2 -mlink-relax
+#ld: -mavrxmega2 --relax
+#source: avr-prop-4.s
+#nm: -n
+#target: avr-*-*
+
+#...
+00000004 T dest
+#...
diff --git a/ld/testsuite/ld-avr/avr-prop-4.s b/ld/testsuite/ld-avr/avr-prop-4.s
new file mode 100644
index 0000000..b1d532f
--- /dev/null
+++ b/ld/testsuite/ld-avr/avr-prop-4.s
@@ -0,0 +1,8 @@
+ .text
+ .global _start, dest
+_start:
+ CALL dest
+ CALL dest
+ .align 2
+dest:
+ NOP