This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Re: Linker script values as absolute / relative / number confusion
- From: "Andrew Burgess" <aburgess at broadcom dot com>
- To: binutils at sourceware dot org
- Date: Fri, 14 Sep 2012 23:53:09 +0100
- Subject: [PATCH] Re: Linker script values as absolute / relative / number confusion
- References: <5053596A.9080506@broadcom.com>
On 14/09/2012 5:20 PM, Andrew Burgess wrote:
>
> So, last bit of info is to figure out where all the changes came from.
> I'm using the git mirror (git://sourceware.org/git/binutils.git), the
> commit that actually changed the behaviour was
> dc027516e99b4795b1fba7179de6fe00606910, which was added as a result of
> bug, http://sourceware.org/bugzilla/show_bug.cgi?id=12066, which was
> raised as a result of commit 557189b0dd1f3dec6b00b91b9b0c5459ece72a52.
Just for fun I backed out commit dc02751... and ran the linker tests and there were no regressions, so I made the following patch based on the bug description in 12066. This currently passes, but fails with dc02751 removed.
I don't have write permissions, so if anyone would like to apply it feel free.
Thanks,
Andrew
ld/testsuite/ChangeLog
2012-09-14 Andrew Burgess <aburgess@broadcom.com>
* ld-scripts/assign-loc.d: New file. Test for assigning absolute
symbol to location counter.
* ld-scripts/assign-loc.t: New file. Linker script for above
test.
* ld-scripts/expr.exp: Add new assignment test.
diff --git a/ld/testsuite/ld-scripts/assign-loc.d b/ld/testsuite/ld-scripts/assign-loc.d
new file mode 100644
index 0000000..dceff7b
--- /dev/null
+++ b/ld/testsuite/ld-scripts/assign-loc.d
@@ -0,0 +1,6 @@
+#ld: -T assign-loc.t
+#source: data.s
+#nm: -n
+0+0100 A HEAP_SIZE
+0+2000 B _start
+0+2100 B _end
diff --git a/ld/testsuite/ld-scripts/assign-loc.t b/ld/testsuite/ld-scripts/assign-loc.t
new file mode 100644
index 0000000..e8c5102
--- /dev/null
+++ b/ld/testsuite/ld-scripts/assign-loc.t
@@ -0,0 +1,17 @@
+SECTIONS
+{
+ . = 0x2000 ;
+
+ _start = .;
+
+ HEAP_SIZE = 0x100;
+
+ .heap : {
+ . = HEAP_SIZE;
+ . = ALIGN(4);
+ }
+
+ _end = .;
+
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
index 185fa4e..ea5002f 100644
--- a/ld/testsuite/ld-scripts/expr.exp
+++ b/ld/testsuite/ld-scripts/expr.exp
@@ -23,3 +23,4 @@
run_dump_test expr1
run_dump_test expr2
run_dump_test sane1
+run_dump_test assign-loc