diff options
Diffstat (limited to 'src/cmd/8l')
-rw-r--r-- | src/cmd/8l/8.out.h | 2 | ||||
-rw-r--r-- | src/cmd/8l/asm.c | 18 | ||||
-rw-r--r-- | src/cmd/8l/l.h | 7 | ||||
-rw-r--r-- | src/cmd/8l/mkenam | 45 |
4 files changed, 14 insertions, 58 deletions
diff --git a/src/cmd/8l/8.out.h b/src/cmd/8l/8.out.h index 8e642d390..ed54f6744 100644 --- a/src/cmd/8l/8.out.h +++ b/src/cmd/8l/8.out.h @@ -32,7 +32,7 @@ #define NSNAME 8 #include "../ld/textflag.h" -enum as +enum { AXXX, AAAA, diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c index c135dce70..98c042403 100644 --- a/src/cmd/8l/asm.c +++ b/src/cmd/8l/asm.c @@ -117,13 +117,21 @@ adddynrel(LSym *s, Reloc *r) case 256 + R_386_GOT32: if(targ->type != SDYNIMPORT) { // have symbol - // turn MOVL of GOT entry into LEAL of symbol itself - if(r->off < 2 || s->p[r->off-2] != 0x8b) { - diag("unexpected GOT reloc for non-dynamic symbol %s", targ->name); + if(r->off >= 2 && s->p[r->off-2] == 0x8b) { + // turn MOVL of GOT entry into LEAL of symbol address, relative to GOT. + s->p[r->off-2] = 0x8d; + r->type = R_GOTOFF; return; } - s->p[r->off-2] = 0x8d; - r->type = R_GOTOFF; + if(r->off >= 2 && s->p[r->off-2] == 0xff && s->p[r->off-1] == 0xb3) { + // turn PUSHL of GOT entry into PUSHL of symbol itself. + // use unnecessary SS prefix to keep instruction same length. + s->p[r->off-2] = 0x36; + s->p[r->off-1] = 0x68; + r->type = R_ADDR; + return; + } + diag("unexpected GOT reloc for non-dynamic symbol %s", targ->name); return; } addgotsym(ctxt, targ); diff --git a/src/cmd/8l/l.h b/src/cmd/8l/l.h index c9695ade0..70d3a4bb4 100644 --- a/src/cmd/8l/l.h +++ b/src/cmd/8l/l.h @@ -50,15 +50,10 @@ enum #define P ((Prog*)0) #define S ((LSym*)0) -#define TNAME (ctxt->cursym?ctxt->cursym->name:noname) enum { - MINSIZ = 4, - STRINGSZ = 200, MINLC = 1, - MAXIO = 8192, - MAXHIST = 40, /* limit of path elements for history symbols */ }; #pragma varargck type "I" uchar* @@ -72,7 +67,6 @@ EXTERN char* rpath; EXTERN int32 spsize; EXTERN LSym* symlist; EXTERN int32 symsize; -EXTERN int32 textsize; int Iconv(Fmt *fp); void adddynlib(char *lib); @@ -85,7 +79,6 @@ int elfreloc1(Reloc *r, vlong sectoff); void elfsetupplt(void); void listinit(void); int machoreloc1(Reloc *r, vlong sectoff); -void main(int argc, char *argv[]); int32 rnd(int32 v, int32 r); void s8put(char *n); char* xsymname(LSym *s); diff --git a/src/cmd/8l/mkenam b/src/cmd/8l/mkenam deleted file mode 100644 index 992aa3160..000000000 --- a/src/cmd/8l/mkenam +++ /dev/null @@ -1,45 +0,0 @@ -# Inferno utils/8c/mkenam -# http://code.google.com/p/inferno-os/source/browse/utils/8c/mkenam -# -# Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. -# Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) -# Portions Copyright © 1997-1999 Vita Nuova Limited -# Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com) -# Portions Copyright © 2004,2006 Bruce Ellis -# Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) -# Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others -# Portions Copyright © 2009 The Go Authors. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -awk ' -BEGIN { - print "char* anames[] =" - print "{" -} - -/^ A/ { - name=$1 - sub(/,/, "", name) - sub(/^A/, "", name) - print "\t\"" name "\"," -} - -END { print "};" } -' ../8l/8.out.h >enam.c |