aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-12-17 11:16:19 +0100
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>2022-12-20 11:37:22 +0100
commit106791196f98a0f21babf4dd46a731b5d1747d3b (patch)
treeddea0ae2f01acd04488d88001e584ba4186dfb80 /ld
parent9d0991449285833b9a77cc02850a1e113e460362 (diff)
downloadbinutils-106791196f98a0f21babf4dd46a731b5d1747d3b.zip
binutils-106791196f98a0f21babf4dd46a731b5d1747d3b.tar.gz
binutils-106791196f98a0f21babf4dd46a731b5d1747d3b.tar.bz2
bfd: Discard symbol regardless of warning flag
The discard of symbols should be performed whether the warning for the discard is enabled or not. Without this patch, ld would segfault in bfd_section_removed_from_list, called in the if-statement right after this block, as the argument isec->output_section can be NULL. Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com> Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp1
-rw-r--r--ld/testsuite/ld-arm/non-contiguous-arm7.d4
-rw-r--r--ld/testsuite/ld-arm/non-contiguous-arm7.ld32
-rw-r--r--ld/testsuite/ld-arm/non-contiguous-arm7.s16
4 files changed, 53 insertions, 0 deletions
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index e53b9bb..ce3605d 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1271,6 +1271,7 @@ run_dump_test "non-contiguous-arm3"
run_dump_test "non-contiguous-arm4"
run_dump_test "non-contiguous-arm5"
run_dump_test "non-contiguous-arm6"
+run_dump_test "non-contiguous-arm7"
if { !$is_nacl && [check_shared_lib_support] } {
run_dump_test "thumb-plt"
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm7.d b/ld/testsuite/ld-arm/non-contiguous-arm7.d
new file mode 100644
index 0000000..b8f08d4
--- /dev/null
+++ b/ld/testsuite/ld-arm/non-contiguous-arm7.d
@@ -0,0 +1,4 @@
+#name: non-contiguous-arm7
+#source: non-contiguous-arm7.s
+#ld: --enable-non-contiguous-regions -T non-contiguous-arm7.ld
+#error: \A.*unresolvable R_ARM_ABS32 relocation against symbol .MY_BUF..*\Z
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm7.ld b/ld/testsuite/ld-arm/non-contiguous-arm7.ld
new file mode 100644
index 0000000..9934fdf
--- /dev/null
+++ b/ld/testsuite/ld-arm/non-contiguous-arm7.ld
@@ -0,0 +1,32 @@
+/*
+ The section .bss.MY_BUF won't fit in RAM1 or RAM2
+*/
+
+MEMORY
+{
+ ROM (rx) : ORIGIN = 0x8000000, LENGTH = 10K
+ RAM1 (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
+ RAM2 (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
+}
+
+SECTIONS
+{
+ .text :
+ {
+ KEEP(*(.text.foo)) ;
+ } >ROM
+
+ .bss :
+ {
+ _sbss = .;
+ *(.bss) *(.bss*) ;
+ _ebss = .;
+ } >RAM1
+
+ .bss_ram2 :
+ {
+ _sbss_ram2 = .;
+ *(.bss) *(.bss*) ;
+ _ebss_ram2 = .;
+ } >RAM2
+}
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm7.s b/ld/testsuite/ld-arm/non-contiguous-arm7.s
new file mode 100644
index 0000000..be0a407
--- /dev/null
+++ b/ld/testsuite/ld-arm/non-contiguous-arm7.s
@@ -0,0 +1,16 @@
+ .global MY_BUF
+ .section .bss.MY_BUF,"aw",%nobits
+ .type MY_BUF, %object
+ .size MY_BUF, 102400
+MY_BUF:
+ .space 102400
+
+ .section .text.foo,"ax",%progbits
+ .global foo
+ .type foo, %function
+foo:
+ ldr r0, .L3
+ bx lr
+.L3:
+ .word MY_BUF
+ .size foo, .-foo