summaryrefslogtreecommitdiff
path: root/src/liblink
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-14 23:25:12 -0400
committerRuss Cox <rsc@golang.org>2014-10-14 23:25:12 -0400
commit601416627d7e4d21399144e43ca539707badbf61 (patch)
tree37368e97beec79dee773662ab08335ffd9d6772b /src/liblink
parentf617e5520bbfe677fed06a1fd2bfedd5ef61a5ef (diff)
downloadgo-601416627d7e4d21399144e43ca539707badbf61.tar.gz
liblink: require DATA lines to be ordered by offset, with no overlap
The assembler could give a better error, but this one is good enough for now. Fixes issue 8880. LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/153610043
Diffstat (limited to 'src/liblink')
-rw-r--r--src/liblink/data.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/liblink/data.c b/src/liblink/data.c
index 4504f4171..e5efa2eb2 100644
--- a/src/liblink/data.c
+++ b/src/liblink/data.c
@@ -83,6 +83,8 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn)
siz = ctxt->arch->datasize(p);
if(off < 0 || siz < 0 || off >= 1<<30 || siz >= 100)
mangle(pn);
+ if(ctxt->enforce_data_order && off < s->np)
+ ctxt->diag("data out of order (already have %d)\n%P", p);
symgrow(ctxt, s, off+siz);
if(p->to.type == ctxt->arch->D_FCONST) {