mirror of
https://github.com/golang/go
synced 2024-11-22 20:40:03 -07:00
8l fixes, cut and paste from 6l.
move PtrSize value into 6l/8l files. R=r DELTA=78 (47 added, 15 deleted, 16 changed) OCL=29729 CL=29798
This commit is contained in:
parent
bf0a339bf3
commit
07393f8706
@ -3,4 +3,8 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
#include "l.h"
|
#include "l.h"
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PtrSize = 8
|
||||||
|
};
|
||||||
#include "../ld/go.c"
|
#include "../ld/go.c"
|
||||||
|
@ -137,10 +137,8 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
} ARGEND
|
} ARGEND
|
||||||
USED(argc);
|
USED(argc);
|
||||||
if(*argv == 0) {
|
if(*argv == 0)
|
||||||
diag("usage: 6l [-options] objects");
|
usage();
|
||||||
errorexit();
|
|
||||||
}
|
|
||||||
|
|
||||||
mywhatsys(); // get goroot, goarch, goos
|
mywhatsys(); // get goroot, goarch, goos
|
||||||
if(strcmp(goarch, thestring) != 0)
|
if(strcmp(goarch, thestring) != 0)
|
||||||
|
@ -416,7 +416,7 @@ asmb(void)
|
|||||||
wputl(0x003E); /* reloc table offset */
|
wputl(0x003E); /* reloc table offset */
|
||||||
wputl(0x0000); /* overlay number */
|
wputl(0x0000); /* overlay number */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
/* apple MACH */
|
/* apple MACH */
|
||||||
va = 4096;
|
va = 4096;
|
||||||
@ -766,6 +766,20 @@ datblk(int32 s, int32 n)
|
|||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case D_SBIG:
|
||||||
|
if(debug['a'] && i == 0) {
|
||||||
|
Bprint(&bso, pcstr, l+s+INITDAT);
|
||||||
|
for(j=0; j<c; j++)
|
||||||
|
Bprint(&bso, "%.2ux", p->to.scon[j] & 0xff);
|
||||||
|
Bprint(&bso, "\t%P\n", curp);
|
||||||
|
}
|
||||||
|
for(; i<c; i++) {
|
||||||
|
buf.dbuf[l] = p->to.sbig[i];
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fl = p->to.offset;
|
fl = p->to.offset;
|
||||||
if(p->to.type == D_ADDR) {
|
if(p->to.type == D_ADDR) {
|
||||||
|
10
src/cmd/8l/go.c
Normal file
10
src/cmd/8l/go.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "l.h"
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PtrSize = 4
|
||||||
|
};
|
||||||
|
#include "../ld/go.c"
|
@ -248,6 +248,7 @@ EXTERN int32 INITDAT;
|
|||||||
EXTERN int32 INITRND;
|
EXTERN int32 INITRND;
|
||||||
EXTERN int32 INITTEXT;
|
EXTERN int32 INITTEXT;
|
||||||
EXTERN char* INITENTRY; /* entry point */
|
EXTERN char* INITENTRY; /* entry point */
|
||||||
|
EXTERN char* LIBDIR;
|
||||||
EXTERN Biobuf bso;
|
EXTERN Biobuf bso;
|
||||||
EXTERN int32 bsssize;
|
EXTERN int32 bsssize;
|
||||||
EXTERN int32 casepc;
|
EXTERN int32 casepc;
|
||||||
|
@ -71,6 +71,13 @@ isobjfile(char *f)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fprint(2, "usage: 8l [-options] [-E entry] [-H head] [-L dir] [-T text] [-R rnd] [-o out] files...\n");
|
||||||
|
exits("usage");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -95,32 +102,26 @@ main(int argc, char *argv[])
|
|||||||
debug[c]++;
|
debug[c]++;
|
||||||
break;
|
break;
|
||||||
case 'o': /* output to (next arg) */
|
case 'o': /* output to (next arg) */
|
||||||
outfile = ARGF();
|
outfile = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
case 'E':
|
case 'E':
|
||||||
a = ARGF();
|
INITENTRY = EARGF(usage());
|
||||||
if(a)
|
|
||||||
INITENTRY = a;
|
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
a = ARGF();
|
HEADTYPE = atolwhex(EARGF(usage()));
|
||||||
if(a)
|
break;
|
||||||
HEADTYPE = atolwhex(a);
|
case 'L':
|
||||||
|
LIBDIR = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
a = ARGF();
|
INITTEXT = atolwhex(EARGF(usage()));
|
||||||
if(a)
|
|
||||||
INITTEXT = atolwhex(a);
|
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
a = ARGF();
|
INITDAT = atolwhex(EARGF(usage()));
|
||||||
if(a)
|
|
||||||
INITDAT = atolwhex(a);
|
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
a = ARGF();
|
INITRND = atolwhex(EARGF(usage()));
|
||||||
if(a)
|
break;
|
||||||
INITRND = atolwhex(a);
|
|
||||||
break;
|
break;
|
||||||
case 'x': /* produce export table */
|
case 'x': /* produce export table */
|
||||||
doexp = 1;
|
doexp = 1;
|
||||||
@ -135,10 +136,8 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
} ARGEND
|
} ARGEND
|
||||||
USED(argc);
|
USED(argc);
|
||||||
if(*argv == 0) {
|
if(*argv == 0)
|
||||||
diag("usage: 8l [-options] objects");
|
usage();
|
||||||
errorexit();
|
|
||||||
}
|
|
||||||
|
|
||||||
whatsys(); // get goroot, goarch, goos
|
whatsys(); // get goroot, goarch, goos
|
||||||
if(strcmp(goarch, thestring) != 0)
|
if(strcmp(goarch, thestring) != 0)
|
||||||
@ -602,12 +601,13 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
|
|||||||
void
|
void
|
||||||
addlib(char *src, char *obj)
|
addlib(char *src, char *obj)
|
||||||
{
|
{
|
||||||
char name[1024], comp[256], *p, *q;
|
char name[1024], pname[1024], comp[256], *p, *q;
|
||||||
int i;
|
int i, search;
|
||||||
|
|
||||||
if(histfrogp <= 0)
|
if(histfrogp <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
search = 0;
|
||||||
if(histfrog[0]->name[1] == '/') {
|
if(histfrog[0]->name[1] == '/') {
|
||||||
sprint(name, "");
|
sprint(name, "");
|
||||||
i = 1;
|
i = 1;
|
||||||
@ -616,11 +616,9 @@ addlib(char *src, char *obj)
|
|||||||
sprint(name, ".");
|
sprint(name, ".");
|
||||||
i = 0;
|
i = 0;
|
||||||
} else {
|
} else {
|
||||||
if(debug['9'])
|
sprint(name, "");
|
||||||
sprint(name, "/%s/lib", thestring);
|
|
||||||
else
|
|
||||||
sprint(name, "/usr/%clib", thechar);
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
search = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; i<histfrogp; i++) {
|
for(; i<histfrogp; i++) {
|
||||||
@ -650,6 +648,16 @@ addlib(char *src, char *obj)
|
|||||||
strcat(name, "/");
|
strcat(name, "/");
|
||||||
strcat(name, comp);
|
strcat(name, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(search) {
|
||||||
|
// try dot, -L "libdir", and then goroot.
|
||||||
|
snprint(pname, sizeof pname, "./%s", name);
|
||||||
|
if(access(pname, AEXIST) < 0 && LIBDIR != nil)
|
||||||
|
snprint(pname, sizeof pname, "%s/%s", LIBDIR, name);
|
||||||
|
if(access(pname, AEXIST) < 0)
|
||||||
|
snprint(pname, sizeof pname, "%s/pkg/%s", goroot, name);
|
||||||
|
strcpy(name, pname);
|
||||||
|
}
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f addlib: %s %s pulls in %s\n", cputime(), obj, src, name);
|
Bprint(&bso, "%5.2f addlib: %s %s pulls in %s\n", cputime(), obj, src, name);
|
||||||
|
|
||||||
@ -976,6 +984,8 @@ loop:
|
|||||||
}
|
}
|
||||||
if(p->to.offset > s->value)
|
if(p->to.offset > s->value)
|
||||||
s->value = p->to.offset;
|
s->value = p->to.offset;
|
||||||
|
if(p->from.scale & DUPOK)
|
||||||
|
s->dupok = 1;
|
||||||
goto loop;
|
goto loop;
|
||||||
|
|
||||||
case ADYNT:
|
case ADYNT:
|
||||||
|
@ -465,7 +465,6 @@ definetypesigs(void)
|
|||||||
qsort(all, n, sizeof all[0], symcmp);
|
qsort(all, n, sizeof all[0], symcmp);
|
||||||
|
|
||||||
// emit array as sequence of references.
|
// emit array as sequence of references.
|
||||||
enum { PtrSize = 8 };
|
|
||||||
for(i=0; i<n; i++) {
|
for(i=0; i<n; i++) {
|
||||||
prog = newdata(s, PtrSize*i, PtrSize, D_EXTERN);
|
prog = newdata(s, PtrSize*i, PtrSize, D_EXTERN);
|
||||||
prog->to.type = D_ADDR;
|
prog->to.type = D_ADDR;
|
||||||
|
Loading…
Reference in New Issue
Block a user