diff options
Diffstat (limited to 'src/cmd/6l')
-rw-r--r-- | src/cmd/6l/6.out.h | 2 | ||||
-rw-r--r-- | src/cmd/6l/asm.c | 17 | ||||
-rw-r--r-- | src/cmd/6l/l.h | 10 | ||||
-rw-r--r-- | src/cmd/6l/mkenam | 45 |
4 files changed, 14 insertions, 60 deletions
diff --git a/src/cmd/6l/6.out.h b/src/cmd/6l/6.out.h index 1e2a1488f..af72784e8 100644 --- a/src/cmd/6l/6.out.h +++ b/src/cmd/6l/6.out.h @@ -36,7 +36,7 @@ * amd64 */ -enum as +enum { AXXX, AAAA, diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c index 7828e2892..18b5aa311 100644 --- a/src/cmd/6l/asm.c +++ b/src/cmd/6l/asm.c @@ -290,7 +290,6 @@ elfreloc1(Reloc *r, vlong sectoff) break; case R_CALL: - case R_PCREL: if(r->siz == 4) { if(r->xsym->type == SDYNIMPORT) VPUT(R_X86_64_GOTPCREL | (uint64)elfsym<<32); @@ -299,7 +298,14 @@ elfreloc1(Reloc *r, vlong sectoff) } else return -1; break; - + + case R_PCREL: + if(r->siz == 4) { + VPUT(R_X86_64_PC32 | (uint64)elfsym<<32); + } else + return -1; + break; + case R_TLS: if(r->siz == 4) { if(flag_shared) @@ -323,7 +329,7 @@ machoreloc1(Reloc *r, vlong sectoff) rs = r->xsym; - if(rs->type == SHOSTOBJ) { + if(rs->type == SHOSTOBJ || r->type == R_PCREL) { if(rs->dynid < 0) { diag("reloc %d to non-macho symbol %s type=%d", r->type, rs->name, rs->type); return -1; @@ -345,10 +351,13 @@ machoreloc1(Reloc *r, vlong sectoff) v |= MACHO_X86_64_RELOC_UNSIGNED<<28; break; case R_CALL: - case R_PCREL: v |= 1<<24; // pc-relative bit v |= MACHO_X86_64_RELOC_BRANCH<<28; break; + case R_PCREL: + // NOTE: Only works with 'external' relocation. Forced above. + v |= 1<<24; // pc-relative bit + v |= MACHO_X86_64_RELOC_SIGNED<<28; } switch(r->siz) { diff --git a/src/cmd/6l/l.h b/src/cmd/6l/l.h index 7303910a6..ff2e69452 100644 --- a/src/cmd/6l/l.h +++ b/src/cmd/6l/l.h @@ -68,14 +68,9 @@ EXTERN int RegSize; #define P ((Prog*)0) #define S ((LSym*)0) -#define TNAME (ctxt->cursym?ctxt->cursym->name:noname) enum { - MINSIZ = 8, - STRINGSZ = 200, MINLC = 1, - MAXIO = 8192, - MAXHIST = 40, /* limit of path elements for history symbols */ }; #pragma varargck type "I" uchar* @@ -89,9 +84,6 @@ EXTERN int32 spsize; EXTERN LSym* symlist; EXTERN int32 symsize; -EXTERN vlong textstksiz; -EXTERN vlong textarg; - int Iconv(Fmt *fp); void adddynlib(char *lib); void adddynrel(LSym *s, Reloc *r); @@ -103,8 +95,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[]); -void parsetextconst(vlong arg); vlong rnd(vlong v, vlong r); /* Native is little-endian */ diff --git a/src/cmd/6l/mkenam b/src/cmd/6l/mkenam deleted file mode 100644 index 3001dbe93..000000000 --- a/src/cmd/6l/mkenam +++ /dev/null @@ -1,45 +0,0 @@ -# Inferno utils/6c/mkenam -# http://code.google.com/p/inferno-os/source/browse/utils/6c/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 "};" } -' ../6l/6.out.h >enam.c |