diff options
author | Elias Naur <elias.naur@gmail.com> | 2013-01-30 08:46:56 -0800 |
---|---|---|
committer | Elias Naur <elias.naur@gmail.com> | 2013-01-30 08:46:56 -0800 |
commit | 65a2fb2ae195745171b9c1ba2b2cabdefee92684 (patch) | |
tree | 514a4b7df37411e9c36d5bd860f6802db64835fa /src/cmd/5l/noop.c | |
parent | 53e3d248870db82f0b383b8aa361b2cebcfd6174 (diff) | |
download | go-65a2fb2ae195745171b9c1ba2b2cabdefee92684.tar.gz |
6l/5l: PIC and shared library support for the linkers.
Added the -shared flag to 5l/6l to output a PIC executable with the required
dynamic relocations and RIP-relative addressing in machine code.
Added dummy support to 8l to avoid compilation errors
See also:
https://codereview.appspot.com/6822078
https://codereview.appspot.com/7064048
and
https://groups.google.com/d/topic/golang-nuts/P05BDjLcQ5k/discussion
R=rsc, iant
CC=golang-dev
https://codereview.appspot.com/6926049
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/5l/noop.c')
-rw-r--r-- | src/cmd/5l/noop.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/5l/noop.c b/src/cmd/5l/noop.c index c50a108f3..99a096a31 100644 --- a/src/cmd/5l/noop.c +++ b/src/cmd/5l/noop.c @@ -45,6 +45,20 @@ static Sym* sym_divu; static Sym* sym_mod; static Sym* sym_modu; +static void +linkcase(Prog *casep) +{ + Prog *p; + + for(p = casep; p != P; p = p->link){ + if(p->as == ABCASE) { + for(; p != P && p->as == ABCASE; p = p->link) + p->pcrel = casep; + break; + } + } +} + void noops(void) { @@ -76,6 +90,11 @@ noops(void) for(cursym = textp; cursym != nil; cursym = cursym->next) { for(p = cursym->text; p != P; p = p->link) { switch(p->as) { + case ACASE: + if(flag_shared) + linkcase(p); + break; + case ATEXT: p->mark |= LEAF; break; |