aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/cofflink.c11
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/scripttempl/mcorepe.sc2
-rw-r--r--ld/testsuite/ld-scripts/pr22267.d3
-rw-r--r--ld/testsuite/ld-scripts/pr22267.t2
6 files changed, 27 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fe38085..d3c1d40 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-10 Jan Beulich <jbeulich@suse.com>
+
+ * cofflink.c (_bfd_coff_write_global_sym): Range-check symbol
+ offset.
+
2021-03-10 Alan Modra <amodra@gmail.com>
Jan Beulich <jbeulich@suse.com>
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 4b0aab2..874354a 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2602,6 +2602,17 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
+ h->root.u.def.section->output_offset);
if (! obj_pe (flaginfo->output_bfd))
isym.n_value += sec->vma;
+#ifdef BFD64
+ if (isym.n_value > (bfd_vma) 0xffffffff)
+ {
+ if (! h->root.linker_def)
+ _bfd_error_handler
+ (_("%pB: stripping non-representable symbol '%s' (value "
+ "%" BFD_VMA_FMT "x)"),
+ output_bfd, h->root.root.string, isym.n_value);
+ return TRUE;
+ }
+#endif
}
break;
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c51332a..ec78541 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2021-03-10 Jan Beulich <jbeulich@suse.com>
+
+ * testsuite/ld-scripts/pr22267.t: Avoid symbol value with more
+ than 32 set bits.
+ * testsuite/ld-scripts/pr22267.d: Adjust expectation and drop
+ comment.
+ * scripttempl/mcorepe.sc: Use PROVIDE() for _stack.
+
2021-03-09 Jan Beulich <jbeulich@suse.com>
* testsuite/ld-pe/reloc.s: Add entry point symbols. Increase
diff --git a/ld/scripttempl/mcorepe.sc b/ld/scripttempl/mcorepe.sc
index 1cdbac2..20fa6f9 100644
--- a/ld/scripttempl/mcorepe.sc
+++ b/ld/scripttempl/mcorepe.sc
@@ -168,7 +168,7 @@ SECTIONS
.stack 0x80000 :
{
- _stack = .;
+ PROVIDE(_stack = .);
*(.stack)
}
}
diff --git a/ld/testsuite/ld-scripts/pr22267.d b/ld/testsuite/ld-scripts/pr22267.d
index b0bd18e..b46fec3 100644
--- a/ld/testsuite/ld-scripts/pr22267.d
+++ b/ld/testsuite/ld-scripts/pr22267.d
@@ -2,7 +2,6 @@
#nm: -n
#xfail: bfin-*-linux* frv-*-linux*
-# Some targets may zero-extend 32-bit address to 64 bits.
#...
-0*f+00 A foo
+0*ff A foo
#pass
diff --git a/ld/testsuite/ld-scripts/pr22267.t b/ld/testsuite/ld-scripts/pr22267.t
index a075405..0049345 100644
--- a/ld/testsuite/ld-scripts/pr22267.t
+++ b/ld/testsuite/ld-scripts/pr22267.t
@@ -1,4 +1,4 @@
SECTIONS
{
- foo = ~0xFF;
+ foo = ~~0xFF;
}