aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorMickael Guene <mickael.guene@st.com>2015-12-22 14:12:35 +0000
committerNick Clifton <nickc@redhat.com>2015-12-22 14:12:35 +0000
commitac4c9b0459fe89f2b84bf8b18a3bf86bf569b7d1 (patch)
treecc76d51d940c65bd0986f73e55a447f12b65652d /ld
parent6d265cb4a956310d2cae231ac63a37e11fe376e1 (diff)
downloadgdb-ac4c9b0459fe89f2b84bf8b18a3bf86bf569b7d1.zip
gdb-ac4c9b0459fe89f2b84bf8b18a3bf86bf569b7d1.tar.gz
gdb-ac4c9b0459fe89f2b84bf8b18a3bf86bf569b7d1.tar.bz2
Add support for ARM's NOREAD section flag.
include/elf * arm.h: Add arm SHF_ARM_NOREAD section flag. bfd * bfd-in2.h: Regenerate. * section.c: Add SEC_ELF_NOREAD. * elf32-arm.c (elf32_arm_post_process_headers): Only set PF_X attribute if a segment only contains section with SHF_ARM_NOREAD flag. (elf32_arm_fake_sections): Add SEC_ELF_NOREAD conversion. (elf32_arm_section_flags): New function to convert SHF_ARM_NOREAD to bfd flag. (elf32_arm_lookup_section_flags): New function to allow INPUT_SECTION_FLAGS directive with SHF_ARM_NOREAD flag. (elf32_arm_special_sections): Add special sections array to catch section prefix by '.text.noread' pattern. ld/testsuite * ld-arm/arm-elf.exp: New tests. * ld-arm/thumb1-input-section-flag-match.d: New * ld-arm/thumb1-input-section-flag-match.s: New * ld-arm/thumb1-noread-not-present-mixing-two-section.d: New * ld-arm/thumb1-noread-not-present-mixing-two-section.s: New * ld-arm/thumb1-noread-present-one-section.d: New * ld-arm/thumb1-noread-present-one-section.s: New * ld-arm/thumb1-noread-present-two-section.d: New * ld-arm/thumb1-noread-present-two-section.s: New binutils * readelf.c (get_elf_section_flags): Add support for ARM specific section flags.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog12
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp12
-rw-r--r--ld/testsuite/ld-arm/arm_noread.ld32
-rw-r--r--ld/testsuite/ld-arm/thumb1-input-section-flag-match.d6
-rw-r--r--ld/testsuite/ld-arm/thumb1-input-section-flag-match.s18
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.d5
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.s18
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-present-one-section.d5
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-present-one-section.s9
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-present-two-section.d5
-rw-r--r--ld/testsuite/ld-arm/thumb1-noread-present-two-section.s19
11 files changed, 141 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index ac3d142..d5982b9 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2015-12-22 Mickael Guene <mickael.guene@st.com>
+
+ * ld-arm/arm-elf.exp: New tests.
+ * ld-arm/thumb1-input-section-flag-match.d: New
+ * ld-arm/thumb1-input-section-flag-match.s: New
+ * ld-arm/thumb1-noread-not-present-mixing-two-section.d: New
+ * ld-arm/thumb1-noread-not-present-mixing-two-section.s: New
+ * ld-arm/thumb1-noread-present-one-section.d: New
+ * ld-arm/thumb1-noread-present-one-section.s: New
+ * ld-arm/thumb1-noread-present-two-section.d: New
+ * ld-arm/thumb1-noread-present-two-section.s: New
+
2015-12-16 Mickael Guene <mickael.guene@st.com>
* ld-arm/arm-elf.exp (armelftests_common): Add new relocations
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 23c9e57..a970dba 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -299,6 +299,18 @@ set armelftests_nonacl {
{"TLS shared library gdesc local" "--no-fix-arm1176 -shared -T arm-dyn.ld" "" "" {tls-lib-loc.s}
{{objdump -fdw tls-lib-loc.d} {objdump -Rw tls-lib-loc.r}}
"tls-lib-loc.so"}
+ {"PF_R not present when one noread section" "-static -T arm.ld" "" "" {thumb1-noread-present-one-section.s}
+ {{readelf -l thumb1-noread-present-one-section.d}}
+ "thumb1-noread-present-one-section"}
+ {"PF_R not present when two noread sections" "-static -T arm.ld" "" "" {thumb1-noread-present-two-section.s}
+ {{readelf -l thumb1-noread-present-two-section.d}}
+ "thumb1-noread-present-two-section"}
+ {"PF_R present when mixing noread section with read section" "-static -T arm.ld" "" "" {thumb1-noread-not-present-mixing-two-section.s}
+ {{readelf -l thumb1-noread-not-present-mixing-two-section.d}}
+ "thumb1-noread-not-present-mixing-two-section"}
+ {"Match SHF_ARM_NOREAD with INPUT_SECTION_FLAGS directive" "-static -T arm_noread.ld" "" "" {thumb1-input-section-flag-match.s}
+ {{readelf -l thumb1-input-section-flag-match.d}}
+ "thumb1-noread-not-present-mixing-two-section"}
}
run_ld_link_tests $armelftests_common
diff --git a/ld/testsuite/ld-arm/arm_noread.ld b/ld/testsuite/ld-arm/arm_noread.ld
new file mode 100644
index 0000000..3ff17bc
--- /dev/null
+++ b/ld/testsuite/ld-arm/arm_noread.ld
@@ -0,0 +1,32 @@
+/* Script for ld testsuite. */
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+MEMORY
+{
+ read_memory (rx) : ORIGIN = 0x00008000, LENGTH = 4M
+ noread_memory (!rx) : ORIGIN = 0x00800000, LENGTH = 4M
+}
+SECTIONS
+{
+ /* Read-only sections, merged into text segment: */
+ PROVIDE (__executable_start = 0x8000); . = 0x8000;
+ .text.noread :
+ {
+ INPUT_SECTION_FLAGS (SHF_ARM_NOREAD) *(.text*)
+ } > noread_memory
+ .text :
+ {
+ *(.before)
+ *(.text)
+ *(.after)
+ *(.ARM.extab*)
+ *(.glue_7)
+ *(.v4_bx)
+ } > read_memory
+ .ARM.exidx : { *(.ARM.exidx*) }
+ . = 0x9000;
+ .got : { *(.got) *(.got.plt)}
+ . = 0x12340000;
+ .far : { *(.far) }
+ .ARM.attribues 0 : { *(.ARM.atttributes) }
+}
diff --git a/ld/testsuite/ld-arm/thumb1-input-section-flag-match.d b/ld/testsuite/ld-arm/thumb1-input-section-flag-match.d
new file mode 100644
index 0000000..e25a4f4
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-input-section-flag-match.d
@@ -0,0 +1,6 @@
+#...
+Program Headers:
+#...
+ LOAD 0x000000 0x00000000 0x00000000 0x08002 0x08002 R E 0x10000
+ LOAD 0x010000 0x00800000 0x00800000 0x00002 0x00002 E 0x10000
+#...
diff --git a/ld/testsuite/ld-arm/thumb1-input-section-flag-match.s b/ld/testsuite/ld-arm/thumb1-input-section-flag-match.s
new file mode 100644
index 0000000..ac7c89f
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-input-section-flag-match.s
@@ -0,0 +1,18 @@
+ .text
+ .section .text.noread
+ .arch armv6s-m
+ .syntax unified
+ .global _start
+ .thumb_func
+ .type _start, %function
+_start:
+ bx lr
+
+ .text
+ .arch armv6s-m
+ .syntax unified
+ .global foo
+ .thumb_func
+ .type foo, %function
+foo:
+ bx lr
diff --git a/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.d b/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.d
new file mode 100644
index 0000000..9150576
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.d
@@ -0,0 +1,5 @@
+#...
+Program Headers:
+#...
+ LOAD 0x000000 0x00000000 0x00000000 0x08004 0x08004 R E 0x10000
+#...
diff --git a/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.s b/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.s
new file mode 100644
index 0000000..ac7c89f
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-not-present-mixing-two-section.s
@@ -0,0 +1,18 @@
+ .text
+ .section .text.noread
+ .arch armv6s-m
+ .syntax unified
+ .global _start
+ .thumb_func
+ .type _start, %function
+_start:
+ bx lr
+
+ .text
+ .arch armv6s-m
+ .syntax unified
+ .global foo
+ .thumb_func
+ .type foo, %function
+foo:
+ bx lr
diff --git a/ld/testsuite/ld-arm/thumb1-noread-present-one-section.d b/ld/testsuite/ld-arm/thumb1-noread-present-one-section.d
new file mode 100644
index 0000000..1faf40c
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-present-one-section.d
@@ -0,0 +1,5 @@
+#...
+Program Headers:
+#...
+ LOAD 0x000000 0x00000000 0x00000000 0x08002 0x08002 E 0x10000
+#...
diff --git a/ld/testsuite/ld-arm/thumb1-noread-present-one-section.s b/ld/testsuite/ld-arm/thumb1-noread-present-one-section.s
new file mode 100644
index 0000000..4be37d2
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-present-one-section.s
@@ -0,0 +1,9 @@
+ .text
+ .section .text.noread
+ .arch armv6s-m
+ .syntax unified
+ .global _start
+ .thumb_func
+ .type _start, %function
+_start:
+ bx lr
diff --git a/ld/testsuite/ld-arm/thumb1-noread-present-two-section.d b/ld/testsuite/ld-arm/thumb1-noread-present-two-section.d
new file mode 100644
index 0000000..365cab0
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-present-two-section.d
@@ -0,0 +1,5 @@
+#...
+Program Headers:
+#...
+ LOAD 0x000000 0x00000000 0x00000000 0x08004 0x08004 E 0x10000
+#...
diff --git a/ld/testsuite/ld-arm/thumb1-noread-present-two-section.s b/ld/testsuite/ld-arm/thumb1-noread-present-two-section.s
new file mode 100644
index 0000000..a97f379
--- /dev/null
+++ b/ld/testsuite/ld-arm/thumb1-noread-present-two-section.s
@@ -0,0 +1,19 @@
+ .text
+ .section .text.noread.first
+ .arch armv6s-m
+ .syntax unified
+ .global _start
+ .thumb_func
+ .type _start, %function
+_start:
+ bx lr
+
+ .text
+ .section .text.noread.second
+ .arch armv6s-m
+ .syntax unified
+ .global foo
+ .thumb_func
+ .type foo, %function
+foo:
+ bx lr