Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
00f4c6a1
Commit
00f4c6a1
authored
Feb 03, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ld: include main and runtime in the library loop
Fixes #585. R=r CC=golang-dev
https://golang.org/cl/195075
parent
4a9a0056
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
17 deletions
+36
-17
src/cmd/5l/obj.c
src/cmd/5l/obj.c
+1
-1
src/cmd/6l/obj.c
src/cmd/6l/obj.c
+1
-1
src/cmd/8l/obj.c
src/cmd/8l/obj.c
+1
-1
src/cmd/ld/lib.c
src/cmd/ld/lib.c
+32
-14
src/cmd/ld/lib.h
src/cmd/ld/lib.h
+1
-0
No files found.
src/cmd/5l/obj.c
View file @
00f4c6a1
...
...
@@ -258,7 +258,7 @@ main(int argc, char *argv[])
firstp
=
prg
();
lastp
=
firstp
;
objfile
(
argv
[
0
],
"main"
);
addlibpath
(
"command line"
,
"command line"
,
argv
[
0
],
"main"
);
if
(
!
debug
[
'l'
])
loadlib
();
...
...
src/cmd/6l/obj.c
View file @
00f4c6a1
...
...
@@ -346,7 +346,7 @@ main(int argc, char *argv[])
firstp
=
prg
();
lastp
=
firstp
;
objfile
(
argv
[
0
],
"main"
);
addlibpath
(
"command line"
,
"command line"
,
argv
[
0
],
"main"
);
if
(
!
debug
[
'l'
])
loadlib
();
...
...
src/cmd/8l/obj.c
View file @
00f4c6a1
...
...
@@ -384,7 +384,7 @@ main(int argc, char *argv[])
firstp
=
prg
();
lastp
=
firstp
;
objfile
(
argv
[
0
],
"main"
);
addlibpath
(
"command line"
,
"command line"
,
argv
[
0
],
"main"
);
if
(
!
debug
[
'l'
])
loadlib
();
...
...
src/cmd/ld/lib.c
View file @
00f4c6a1
...
...
@@ -94,7 +94,6 @@ addlib(char *src, char *obj)
{
char
name
[
1024
],
pname
[
1024
],
comp
[
256
],
*
p
;
int
i
,
search
;
Library
*
l
;
if
(
histfrogp
<=
0
)
return
;
...
...
@@ -160,9 +159,26 @@ addlib(char *src, char *obj)
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f addlib: %s %s pulls in %s
\n
"
,
cputime
(),
obj
,
src
,
pname
);
addlibpath
(
src
,
obj
,
pname
,
name
);
}
/*
* add library to library list.
* srcref: src file referring to package
* objref: object file referring to package
* file: object file, e.g., /home/rsc/go/pkg/container/vector.a
* pkg: package import path, e.g. container/vector
*/
void
addlibpath
(
char
*
srcref
,
char
*
objref
,
char
*
file
,
char
*
pkg
)
{
int
i
;
Library
*
l
;
char
*
p
;
for
(
i
=
0
;
i
<
libraryp
;
i
++
)
if
(
strcmp
(
pnam
e
,
library
[
i
].
file
)
==
0
)
if
(
strcmp
(
fil
e
,
library
[
i
].
file
)
==
0
)
return
;
if
(
libraryp
==
nlibrary
){
nlibrary
=
50
+
2
*
libraryp
;
...
...
@@ -171,20 +187,20 @@ addlib(char *src, char *obj)
l
=
&
library
[
libraryp
++
];
p
=
mal
(
strlen
(
obj
)
+
1
);
strcpy
(
p
,
obj
);
p
=
mal
(
strlen
(
obj
ref
)
+
1
);
strcpy
(
p
,
obj
ref
);
l
->
objref
=
p
;
p
=
mal
(
strlen
(
src
)
+
1
);
strcpy
(
p
,
src
);
p
=
mal
(
strlen
(
src
ref
)
+
1
);
strcpy
(
p
,
src
ref
);
l
->
srcref
=
p
;
p
=
mal
(
strlen
(
pnam
e
)
+
1
);
strcpy
(
p
,
pnam
e
);
p
=
mal
(
strlen
(
fil
e
)
+
1
);
strcpy
(
p
,
fil
e
);
l
->
file
=
p
;
p
=
mal
(
strlen
(
name
)
+
1
);
strcpy
(
p
,
name
);
p
=
mal
(
strlen
(
pkg
)
+
1
);
strcpy
(
p
,
pkg
);
l
->
pkg
=
p
;
}
...
...
@@ -196,6 +212,11 @@ loadlib(void)
Sym
*
s
;
char
*
a
;
i
=
strlen
(
goroot
)
+
strlen
(
goarch
)
+
strlen
(
goos
)
+
20
;
a
=
mal
(
i
);
snprint
(
a
,
i
,
"%s/pkg/%s_%s/runtime.a"
,
goroot
,
goos
,
goarch
);
addlibpath
(
"internal"
,
"internal"
,
a
,
"runtime"
);
loop:
xrefresolv
=
0
;
for
(
i
=
0
;
i
<
libraryp
;
i
++
)
{
...
...
@@ -203,16 +224,13 @@ loop:
Bprint
(
&
bso
,
"%5.2f autolib: %s (from %s)
\n
"
,
cputime
(),
library
[
i
].
file
,
library
[
i
].
objref
);
objfile
(
library
[
i
].
file
,
library
[
i
].
pkg
);
}
if
(
xrefresolv
)
for
(
h
=
0
;
h
<
nelem
(
hash
);
h
++
)
for
(
s
=
hash
[
h
];
s
!=
S
;
s
=
s
->
link
)
if
(
s
->
type
==
SXREF
)
goto
loop
;
i
=
strlen
(
goroot
)
+
strlen
(
goarch
)
+
strlen
(
goos
)
+
20
;
a
=
mal
(
i
);
snprint
(
a
,
i
,
"%s/pkg/%s_%s/runtime.a"
,
goroot
,
goos
,
goarch
);
objfile
(
a
,
"runtime"
);
}
void
...
...
src/cmd/ld/lib.h
View file @
00f4c6a1
...
...
@@ -63,6 +63,7 @@ EXTERN int32 nsymbol;
EXTERN
char
*
thestring
;
void
addlib
(
char
*
src
,
char
*
obj
);
void
addlibpath
(
char
*
srcref
,
char
*
objref
,
char
*
file
,
char
*
pkg
);
void
copyhistfrog
(
char
*
buf
,
int
nbuf
);
void
addhist
(
int32
line
,
int
type
);
void
histtoauto
(
void
);
...
...
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