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
7c534e1b
Commit
7c534e1b
authored
Jul 08, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the ld-supplied typestrings are now obsolete
R=r DELTA=167 (0 added, 167 deleted, 0 changed) OCL=31304 CL=31316
parent
9809d738
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
167 deletions
+0
-167
l.h
src/cmd/5l/l.h
+0
-2
obj.c
src/cmd/5l/obj.c
+0
-2
l.h
src/cmd/6l/l.h
+0
-2
obj.c
src/cmd/6l/obj.c
+0
-2
l.h
src/cmd/8l/l.h
+0
-2
obj.c
src/cmd/8l/obj.c
+0
-2
go.c
src/cmd/ld/go.c
+0
-155
No files found.
src/cmd/5l/l.h
View file @
7c534e1b
...
...
@@ -498,8 +498,6 @@ int linuxstrtable(void);
* go.c
*/
void
deadcode
(
void
);
void
definetypestrings
(
void
);
void
definetypesigs
(
void
);
char
*
gotypefor
(
char
*
name
);
void
ldpkg
(
Biobuf
*
f
,
int64
len
,
char
*
filename
);
...
...
src/cmd/5l/obj.c
View file @
7c534e1b
...
...
@@ -279,8 +279,6 @@ main(int argc, char *argv[])
sprint
(
a
,
"%s/pkg/%s_%s/runtime.a"
,
goroot
,
goos
,
goarch
);
objfile
(
a
);
}
definetypestrings
();
definetypesigs
();
deadcode
();
firstp
=
firstp
->
link
;
...
...
src/cmd/6l/l.h
View file @
7c534e1b
...
...
@@ -387,8 +387,6 @@ Prog* copyp(Prog*);
double
cputime
(
void
);
void
datblk
(
int32
,
int32
);
void
deadcode
(
void
);
void
definetypestrings
(
void
);
void
definetypesigs
(
void
);
void
diag
(
char
*
,
...);
void
dodata
(
void
);
void
doinit
(
void
);
...
...
src/cmd/6l/obj.c
View file @
7c534e1b
...
...
@@ -362,8 +362,6 @@ main(int argc, char *argv[])
sprint
(
a
,
"%s/pkg/%s_%s/runtime.a"
,
goroot
,
goos
,
goarch
);
objfile
(
a
);
}
definetypestrings
();
definetypesigs
();
deadcode
();
firstp
=
firstp
->
link
;
...
...
src/cmd/8l/l.h
View file @
7c534e1b
...
...
@@ -391,8 +391,6 @@ void whatsys(void);
* go.c
*/
void
deadcode
(
void
);
void
definetypestrings
(
void
);
void
definetypesigs
(
void
);
char
*
gotypefor
(
char
*
name
);
void
ldpkg
(
Biobuf
*
f
,
int64
len
,
char
*
filename
);
...
...
src/cmd/8l/obj.c
View file @
7c534e1b
...
...
@@ -332,8 +332,6 @@ main(int argc, char *argv[])
sprint
(
a
,
"%s/pkg/%s_%s/runtime.a"
,
goroot
,
goos
,
goarch
);
objfile
(
a
);
}
definetypestrings
();
definetypesigs
();
deadcode
();
firstp
=
firstp
->
link
;
...
...
src/cmd/ld/go.c
View file @
7c534e1b
...
...
@@ -6,11 +6,8 @@
// accumulate all type information from .6 files.
// check for inconsistencies.
// define gotypestrings variable if needed.
// define gotypesigs variable if needed.
// TODO:
// include type info for non-exported types.
// generate debugging section in binary.
// once the dust settles, try to move some code to
// libmach, so that other linkers and ar can share.
...
...
@@ -338,158 +335,6 @@ symcmp(const void *va, const void *vb)
return
strcmp
(
a
->
name
,
b
->
name
);
}
// if there is an undefined reference to gotypestrings,
// create it. c declaration is
// extern char gotypestrings[];
// ironically, gotypestrings is a c variable, because there
// is no way to forward declare a string in go.
void
definetypestrings
(
void
)
{
int
i
,
j
,
len
,
n
,
w
;
char
*
p
;
Import
**
all
,
*
x
;
Fmt
f
;
Prog
*
prog
;
Sym
*
s
;
if
(
debug
[
'g'
])
return
;
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f definetypestrings
\n
"
,
cputime
());
s
=
lookup
(
"gotypestrings"
,
0
);
if
(
s
->
type
==
0
)
return
;
if
(
s
->
type
!=
SXREF
)
{
diag
(
"gotypestrings already defined"
);
return
;
}
s
->
type
=
SDATA
;
// make a list of all the type exports
n
=
0
;
for
(
i
=
0
;
i
<
NIHASH
;
i
++
)
for
(
x
=
ihash
[
i
];
x
;
x
=
x
->
hash
)
if
(
strcmp
(
x
->
prefix
,
"type"
)
==
0
)
n
++
;
all
=
mal
(
n
*
sizeof
all
[
0
]);
j
=
0
;
for
(
i
=
0
;
i
<
NIHASH
;
i
++
)
for
(
x
=
ihash
[
i
];
x
;
x
=
x
->
hash
)
if
(
strcmp
(
x
->
prefix
,
"type"
)
==
0
)
all
[
j
++
]
=
x
;
// sort them by name
qsort
(
all
,
n
,
sizeof
all
[
0
],
importcmp
);
// make a big go string containing all the types
fmtstrinit
(
&
f
);
fmtprint
(
&
f
,
"xxxx"
);
// 4-byte length
for
(
i
=
0
;
i
<
n
;
i
++
)
{
p
=
strchr
(
all
[
i
]
->
def
,
'\n'
);
if
(
p
)
len
=
p
-
all
[
i
]
->
def
;
else
len
=
strlen
(
all
[
i
]
->
def
);
fmtprint
(
&
f
,
"%s %.*s
\n
"
,
all
[
i
]
->
name
,
utfnlen
(
all
[
i
]
->
def
,
len
),
all
[
i
]
->
def
);
}
p
=
fmtstrflush
(
&
f
);
n
=
strlen
(
p
);
s
->
value
=
n
;
// go strings begin with 4-byte length.
// amd64 is little-endian.
len
=
n
-
4
;
p
[
0
]
=
len
;
p
[
1
]
=
len
>>
8
;
p
[
2
]
=
len
>>
16
;
p
[
3
]
=
len
>>
24
;
// have data, need to create linker representation.
// linker stores big data as sequence of pieces
// with int8 length, so break p into 100-byte chunks.
// (had to add D_SBIG even to do that; the compiler
// would have generated 8-byte chunks.)
for
(
i
=
0
;
i
<
n
;
i
+=
100
)
{
w
=
100
;
if
(
w
>
n
-
i
)
w
=
n
-
i
;
prog
=
newdata
(
s
,
i
,
w
,
D_EXTERN
);
prog
->
to
.
type
=
D_SBIG
;
prog
->
to
.
sbig
=
p
+
i
;
}
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f typestrings %d
\n
"
,
cputime
(),
n
);
}
// if there is an undefined reference to gotypesigs, create it.
// c declaration is
// extern Sigt *gotypesigs[];
// extern int ngotypesigs;
// used by sys.unreflect runtime.
void
definetypesigs
(
void
)
{
int
i
,
j
,
n
;
Sym
**
all
,
*
s
,
*
x
;
Prog
*
prog
;
if
(
debug
[
'g'
])
return
;
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f definetypesigs
\n
"
,
cputime
());
s
=
lookup
(
"gotypesigs"
,
0
);
if
(
s
->
type
==
0
)
return
;
if
(
s
->
type
!=
SXREF
)
{
diag
(
"gotypesigs already defined"
);
return
;
}
s
->
type
=
SDATA
;
// make a list of all the sigt symbols.
n
=
0
;
for
(
i
=
0
;
i
<
NHASH
;
i
++
)
for
(
x
=
hash
[
i
];
x
;
x
=
x
->
link
)
if
(
memcmp
(
x
->
name
,
"sigt·"
,
6
)
==
0
&&
x
->
type
!=
Sxxx
)
n
++
;
all
=
mal
(
n
*
sizeof
all
[
0
]);
j
=
0
;
for
(
i
=
0
;
i
<
NHASH
;
i
++
)
for
(
x
=
hash
[
i
];
x
;
x
=
x
->
link
)
if
(
memcmp
(
x
->
name
,
"sigt·"
,
6
)
==
0
&&
x
->
type
!=
Sxxx
)
all
[
j
++
]
=
x
;
// sort them by name
qsort
(
all
,
n
,
sizeof
all
[
0
],
symcmp
);
// emit array as sequence of references.
for
(
i
=
0
;
i
<
n
;
i
++
)
{
prog
=
newdata
(
s
,
PtrSize
*
i
,
PtrSize
,
D_EXTERN
);
prog
->
to
.
type
=
D_ADDR
;
prog
->
to
.
index
=
D_EXTERN
;
prog
->
to
.
sym
=
all
[
i
];
}
s
->
value
=
PtrSize
*
n
;
if
(
n
==
0
)
s
->
value
=
1
;
// must have non-zero size or 6l complains
// emit count
s
=
lookup
(
"ngotypesigs"
,
0
);
s
->
type
=
SDATA
;
s
->
value
=
sizeof
(
int32
);
prog
=
newdata
(
s
,
0
,
sizeof
(
int32
),
D_EXTERN
);
prog
->
to
.
offset
=
n
;
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f typesigs %d
\n
"
,
cputime
(),
n
);
}
static
void
mark
(
Sym
*
);
static
int
markdepth
;
...
...
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