mirror of
https://github.com/golang/go
synced 2024-11-21 23:14:40 -07:00
ld: Add -I option to set ELF interpreter.
R=rsc CC=golang-dev https://golang.org/cl/4080049
This commit is contained in:
parent
eea18d959e
commit
9040da9e40
@ -448,7 +448,9 @@ asmb(void)
|
|||||||
sh->type = SHT_PROGBITS;
|
sh->type = SHT_PROGBITS;
|
||||||
sh->flags = SHF_ALLOC;
|
sh->flags = SHF_ALLOC;
|
||||||
sh->addralign = 1;
|
sh->addralign = 1;
|
||||||
elfinterp(sh, startva, linuxdynld);
|
if(interpreter == nil)
|
||||||
|
interpreter = linuxdynld;
|
||||||
|
elfinterp(sh, startva, interpreter);
|
||||||
|
|
||||||
ph = newElfPhdr();
|
ph = newElfPhdr();
|
||||||
ph->type = PT_INTERP;
|
ph->type = PT_INTERP;
|
||||||
|
@ -23,6 +23,8 @@ Options new in this version:
|
|||||||
-F
|
-F
|
||||||
Force use of software floating point.
|
Force use of software floating point.
|
||||||
Also implied by setting GOARM=5 in the environment.
|
Also implied by setting GOARM=5 in the environment.
|
||||||
|
-I interpreter
|
||||||
|
Set the ELF dynamic linker to use.
|
||||||
-L dir1 -L dir2
|
-L dir1 -L dir2
|
||||||
Search for libraries (package files) in dir1, dir2, etc.
|
Search for libraries (package files) in dir1, dir2, etc.
|
||||||
The default is the single location $GOROOT/pkg/$GOOS_arm.
|
The default is the single location $GOROOT/pkg/$GOOS_arm.
|
||||||
|
@ -332,6 +332,7 @@ EXTERN Oprang thumboprange[ALAST];
|
|||||||
EXTERN char* outfile;
|
EXTERN char* outfile;
|
||||||
EXTERN int32 pc;
|
EXTERN int32 pc;
|
||||||
EXTERN uchar repop[ALAST];
|
EXTERN uchar repop[ALAST];
|
||||||
|
EXTERN char* interpreter;
|
||||||
EXTERN char* rpath;
|
EXTERN char* rpath;
|
||||||
EXTERN uint32 stroffset;
|
EXTERN uint32 stroffset;
|
||||||
EXTERN int32 symsize;
|
EXTERN int32 symsize;
|
||||||
|
@ -61,7 +61,7 @@ linkername[] =
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: 5l [-E entry] [-H head] [-L dir] [-T text] [-D data] [-R rnd] [-r path] [-o out] main.5\n");
|
fprint(2, "usage: 5l [-E entry] [-H head] [-I interpreter] [-L dir] [-T text] [-D data] [-R rnd] [-r path] [-o out] main.5\n");
|
||||||
errorexit();
|
errorexit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +100,9 @@ main(int argc, char *argv[])
|
|||||||
case 'E':
|
case 'E':
|
||||||
INITENTRY = EARGF(usage());
|
INITENTRY = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
interpreter = EARGF(usage());
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
Lflag(EARGF(usage()));
|
Lflag(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
|
@ -915,14 +915,17 @@ asmb(void)
|
|||||||
sh->type = SHT_PROGBITS;
|
sh->type = SHT_PROGBITS;
|
||||||
sh->flags = SHF_ALLOC;
|
sh->flags = SHF_ALLOC;
|
||||||
sh->addralign = 1;
|
sh->addralign = 1;
|
||||||
switch(HEADTYPE) {
|
if(interpreter == nil) {
|
||||||
case 7:
|
switch(HEADTYPE) {
|
||||||
elfinterp(sh, startva, linuxdynld);
|
case 7:
|
||||||
break;
|
interpreter = linuxdynld;
|
||||||
case 9:
|
break;
|
||||||
elfinterp(sh, startva, freebsddynld);
|
case 9:
|
||||||
break;
|
interpreter = freebsddynld;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
elfinterp(sh, startva, interpreter);
|
||||||
|
|
||||||
ph = newElfPhdr();
|
ph = newElfPhdr();
|
||||||
ph->type = PT_INTERP;
|
ph->type = PT_INTERP;
|
||||||
|
@ -32,6 +32,8 @@ Options new in this version:
|
|||||||
Write Apple Mach-O binaries (default when $GOOS is darwin)
|
Write Apple Mach-O binaries (default when $GOOS is darwin)
|
||||||
-H7
|
-H7
|
||||||
Write Linux ELF binaries (default when $GOOS is linux)
|
Write Linux ELF binaries (default when $GOOS is linux)
|
||||||
|
-I interpreter
|
||||||
|
Set the ELF dynamic linker to use.
|
||||||
-L dir1 -L dir2
|
-L dir1 -L dir2
|
||||||
Search for libraries (package files) in dir1, dir2, etc.
|
Search for libraries (package files) in dir1, dir2, etc.
|
||||||
The default is the single location $GOROOT/pkg/$GOOS_amd64.
|
The default is the single location $GOROOT/pkg/$GOOS_amd64.
|
||||||
|
@ -352,6 +352,7 @@ EXTERN int nerrors;
|
|||||||
EXTERN char* noname;
|
EXTERN char* noname;
|
||||||
EXTERN char* outfile;
|
EXTERN char* outfile;
|
||||||
EXTERN vlong pc;
|
EXTERN vlong pc;
|
||||||
|
EXTERN char* interpreter;
|
||||||
EXTERN char* rpath;
|
EXTERN char* rpath;
|
||||||
EXTERN int32 spsize;
|
EXTERN int32 spsize;
|
||||||
EXTERN Sym* symlist;
|
EXTERN Sym* symlist;
|
||||||
|
@ -58,7 +58,7 @@ char* paramspace = "FP";
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: 6l [-options] [-E entry] [-H head] [-L dir] [-T text] [-R rnd] [-r path] [-o out] main.6\n");
|
fprint(2, "usage: 6l [-options] [-E entry] [-H head] [-I interpreter] [-L dir] [-T text] [-R rnd] [-r path] [-o out] main.6\n");
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +96,9 @@ main(int argc, char *argv[])
|
|||||||
case 'H':
|
case 'H':
|
||||||
HEADTYPE = atolwhex(EARGF(usage()));
|
HEADTYPE = atolwhex(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
interpreter = EARGF(usage());
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
Lflag(EARGF(usage()));
|
Lflag(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
|
@ -936,14 +936,17 @@ asmb(void)
|
|||||||
sh->type = SHT_PROGBITS;
|
sh->type = SHT_PROGBITS;
|
||||||
sh->flags = SHF_ALLOC;
|
sh->flags = SHF_ALLOC;
|
||||||
sh->addralign = 1;
|
sh->addralign = 1;
|
||||||
switch(HEADTYPE) {
|
if(interpreter == nil) {
|
||||||
case 7:
|
switch(HEADTYPE) {
|
||||||
elfinterp(sh, startva, linuxdynld);
|
case 7:
|
||||||
break;
|
interpreter = linuxdynld;
|
||||||
case 9:
|
break;
|
||||||
elfinterp(sh, startva, freebsddynld);
|
case 9:
|
||||||
break;
|
interpreter = freebsddynld;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
elfinterp(sh, startva, interpreter);
|
||||||
|
|
||||||
ph = newElfPhdr();
|
ph = newElfPhdr();
|
||||||
ph->type = PT_INTERP;
|
ph->type = PT_INTERP;
|
||||||
|
@ -29,6 +29,8 @@ Options new in this version:
|
|||||||
Write Apple Mach-O binaries (default when $GOOS is darwin)
|
Write Apple Mach-O binaries (default when $GOOS is darwin)
|
||||||
-H7
|
-H7
|
||||||
Write Linux ELF binaries (default when $GOOS is linux)
|
Write Linux ELF binaries (default when $GOOS is linux)
|
||||||
|
-I interpreter
|
||||||
|
Set the ELF dynamic linker to use.
|
||||||
-L dir1 -L dir2
|
-L dir1 -L dir2
|
||||||
Search for libraries (package files) in dir1, dir2, etc.
|
Search for libraries (package files) in dir1, dir2, etc.
|
||||||
The default is the single location $GOROOT/pkg/$GOOS_386.
|
The default is the single location $GOROOT/pkg/$GOOS_386.
|
||||||
|
@ -315,6 +315,7 @@ EXTERN int maxop;
|
|||||||
EXTERN int nerrors;
|
EXTERN int nerrors;
|
||||||
EXTERN char* noname;
|
EXTERN char* noname;
|
||||||
EXTERN int32 pc;
|
EXTERN int32 pc;
|
||||||
|
EXTERN char* interpreter;
|
||||||
EXTERN char* rpath;
|
EXTERN char* rpath;
|
||||||
EXTERN int32 spsize;
|
EXTERN int32 spsize;
|
||||||
EXTERN Sym* symlist;
|
EXTERN Sym* symlist;
|
||||||
|
@ -64,7 +64,7 @@ char *thestring = "386";
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: 8l [-options] [-E entry] [-H head] [-L dir] [-T text] [-R rnd] [-r path] [-o out] main.8\n");
|
fprint(2, "usage: 8l [-options] [-E entry] [-H head] [-I interpreter] [-L dir] [-T text] [-R rnd] [-r path] [-o out] main.8\n");
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +102,9 @@ main(int argc, char *argv[])
|
|||||||
case 'H':
|
case 'H':
|
||||||
HEADTYPE = atolwhex(EARGF(usage()));
|
HEADTYPE = atolwhex(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
|
case 'I':
|
||||||
|
interpreter = EARGF(usage());
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
Lflag(EARGF(usage()));
|
Lflag(EARGF(usage()));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user