From fa563ae82e2d1038656be21c52831e7ad42108a8 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 10 Oct 2012 00:55:48 +0800 Subject: cmd/ld, cmd/6l, cmd/8l: sort exported dynamic symbols for Darwin Also corrected cmd/8l's .dynsym handling (differentiate between exported symbols and imported symbols) Fixes #4029. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6620075 --- src/cmd/ld/data.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/cmd/ld/data.c') diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c index 4afe4b801c..e551f72903 100644 --- a/src/cmd/ld/data.c +++ b/src/cmd/ld/data.c @@ -793,6 +793,33 @@ addaddr(Sym *s, Sym *t) return addaddrplus(s, t, 0); } +vlong +setaddrplus(Sym *s, vlong off, Sym *t, int32 add) +{ + Reloc *r; + + if(s->type == 0) + s->type = SDATA; + s->reachable = 1; + if(off+PtrSize > s->size) { + s->size = off + PtrSize; + symgrow(s, s->size); + } + r = addrel(s); + r->sym = t; + r->off = off; + r->siz = PtrSize; + r->type = D_ADDR; + r->add = add; + return off; +} + +vlong +setaddr(Sym *s, vlong off, Sym *t) +{ + return setaddrplus(s, off, t, 0); +} + vlong addsize(Sym *s, Sym *t) { -- cgit v1.3-5-g9baa