Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
7d443bb6
Commit
7d443bb6
authored
Mar 20, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make 8l generate Darwin Mach-O and Linux ELF binaries
R=ken OCL=26584 CL=26589
parent
997b6f9d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
19 deletions
+59
-19
asm.c
src/cmd/8l/asm.c
+0
-0
l.h
src/cmd/8l/l.h
+9
-1
obj.c
src/cmd/8l/obj.c
+49
-17
span.c
src/cmd/8l/span.c
+1
-1
No files found.
src/cmd/8l/asm.c
View file @
7d443bb6
This diff is collapsed.
Click to expand it.
src/cmd/8l/l.h
View file @
7d443bb6
...
...
@@ -365,11 +365,19 @@ void span(void);
void
undef
(
void
);
void
undefsym
(
Sym
*
);
int32
vaddr
(
Adr
*
);
void
wput
b
(
ushort
);
void
wput
(
ushort
);
void
xdefine
(
char
*
,
int
,
int32
);
void
xfol
(
Prog
*
);
int
zaddr
(
uchar
*
,
Adr
*
,
Sym
*
[]);
void
zerosig
(
char
*
);
uint32
machheadr
(
void
);
uint32
elfheadr
(
void
);
void
whatsys
(
void
);
/* set by call to whatsys() */
extern
char
*
goroot
;
extern
char
*
goarch
;
extern
char
*
goos
;
#pragma varargck type "D" Adr*
#pragma varargck type "P" Prog*
...
...
src/cmd/8l/obj.c
View file @
7d443bb6
...
...
@@ -139,16 +139,22 @@ main(int argc, char *argv[])
diag
(
"usage: 8l [-options] objects"
);
errorexit
();
}
if
(
!
debug
[
'9'
]
&&
!
debug
[
'U'
]
&&
!
debug
[
'B'
])
debug
[
DEFAULT
]
=
1
;
whatsys
();
// get goroot, goarch, goos
if
(
strcmp
(
goarch
,
thestring
)
!=
0
)
print
(
"goarch is not known: %s
\n
"
,
goarch
);
if
(
HEADTYPE
==
-
1
)
{
if
(
debug
[
'U'
])
HEADTYPE
=
1
;
if
(
debug
[
'B'
])
HEADTYPE
=
2
;
if
(
debug
[
'9'
])
HEADTYPE
=
2
;
HEADTYPE
=
2
;
if
(
strcmp
(
goos
,
"linux"
)
==
0
)
HEADTYPE
=
7
;
else
if
(
strcmp
(
goos
,
"darwin"
)
==
0
)
HEADTYPE
=
6
;
else
print
(
"goos is not known: %sn"
,
goos
);
}
switch
(
HEADTYPE
)
{
default:
diag
(
"unknown -H option"
);
...
...
@@ -202,6 +208,24 @@ main(int argc, char *argv[])
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"HEADR = 0x%ld
\n
"
,
HEADR
);
break
;
case
6
:
/* apple MACH */
HEADR
=
machheadr
();
if
(
INITTEXT
==
-
1
)
INITTEXT
=
4096
+
HEADR
;
if
(
INITDAT
==
-
1
)
INITDAT
=
0
;
if
(
INITRND
==
-
1
)
INITRND
=
4096
;
break
;
case
7
:
/* elf32 executable */
HEADR
=
elfheadr
();
if
(
INITTEXT
==
-
1
)
INITTEXT
=
0x08048000
+
HEADR
;
if
(
INITDAT
==
-
1
)
INITDAT
=
0
;
if
(
INITRND
==
-
1
)
INITRND
=
4096
;
break
;
}
if
(
INITDAT
!=
0
&&
INITRND
!=
0
)
print
(
"warning: -D0x%lux is ignored because of -R0x%lux
\n
"
,
...
...
@@ -294,19 +318,27 @@ main(int argc, char *argv[])
firstp
=
prg
();
lastp
=
firstp
;
if
(
INITENTRY
==
0
)
{
INITENTRY
=
"_main"
;
if
(
debug
[
'p'
])
INITENTRY
=
"_mainp"
;
if
(
!
debug
[
'l'
])
lookup
(
INITENTRY
,
0
)
->
type
=
SXREF
;
}
else
lookup
(
INITENTRY
,
0
)
->
type
=
SXREF
;
if
(
INITENTRY
==
nil
)
{
INITENTRY
=
mal
(
strlen
(
goarch
)
+
strlen
(
goos
)
+
10
);
sprint
(
INITENTRY
,
"_rt0_%s_%s"
,
goarch
,
goos
);
}
lookup
(
INITENTRY
,
0
)
->
type
=
SXREF
;
if
(
!
debug
[
'l'
])
{
a
=
mal
(
strlen
(
goroot
)
+
strlen
(
goarch
)
+
strlen
(
goos
)
+
20
);
sprint
(
a
,
"%s/lib/rt0_%s_%s.%c"
,
goroot
,
goarch
,
goos
,
thechar
);
objfile
(
a
);
}
while
(
*
argv
)
objfile
(
*
argv
++
);
if
(
!
debug
[
'l'
])
if
(
!
debug
[
'l'
])
{
loadlib
();
a
=
mal
(
strlen
(
goroot
)
+
strlen
(
goarch
)
+
strlen
(
goos
)
+
20
);
sprint
(
a
,
"%s/lib/lib_%s_%s.a"
,
goroot
,
goarch
,
goos
);
objfile
(
a
);
}
firstp
=
firstp
->
link
;
if
(
firstp
==
P
)
errorexit
();
...
...
src/cmd/8l/span.c
View file @
7d443bb6
...
...
@@ -1396,7 +1396,7 @@ asmdyn()
t
++
;
}
else
if
(
c
==
1
){
wput
b
(
ra
);
wput
(
ra
);
t
+=
2
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment