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
8132f1d0
Commit
8132f1d0
authored
Dec 08, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6l, 8l: minor changes & cleanup
R=ken2, ken3 CC=golang-dev
https://golang.org/cl/3505041
parent
4d8d6d5c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
56 deletions
+44
-56
src/cmd/6l/obj.c
src/cmd/6l/obj.c
+3
-2
src/cmd/6l/pass.c
src/cmd/6l/pass.c
+12
-8
src/cmd/6l/span.c
src/cmd/6l/span.c
+1
-17
src/cmd/8l/obj.c
src/cmd/8l/obj.c
+1
-0
src/cmd/8l/pass.c
src/cmd/8l/pass.c
+16
-9
src/cmd/8l/span.c
src/cmd/8l/span.c
+5
-17
src/cmd/ld/dwarf.c
src/cmd/ld/dwarf.c
+5
-2
src/cmd/ld/elf.h
src/cmd/ld/elf.h
+1
-1
No files found.
src/cmd/6l/obj.c
View file @
8132f1d0
...
...
@@ -245,6 +245,7 @@ main(int argc, char *argv[])
else
doprof2
();
span
();
textaddress
();
pclntab
();
symtab
();
dodata
();
...
...
@@ -627,7 +628,7 @@ loop:
if
(
s
->
type
==
0
)
{
s
->
type
=
SDATA
;
adduint32
(
s
,
ieeedtof
(
&
p
->
from
.
ieee
));
s
->
reachable
=
1
;
s
->
reachable
=
0
;
}
p
->
from
.
type
=
D_EXTERN
;
p
->
from
.
sym
=
s
;
...
...
@@ -662,7 +663,7 @@ loop:
s
->
type
=
SDATA
;
adduint32
(
s
,
p
->
from
.
ieee
.
l
);
adduint32
(
s
,
p
->
from
.
ieee
.
h
);
s
->
reachable
=
1
;
s
->
reachable
=
0
;
}
p
->
from
.
type
=
D_EXTERN
;
p
->
from
.
sym
=
s
;
...
...
src/cmd/6l/pass.c
View file @
8132f1d0
...
...
@@ -289,24 +289,25 @@ patch(void)
if
(
s
)
{
if
(
debug
[
'c'
])
Bprint
(
&
bso
,
"%s calls %s
\n
"
,
TNAME
,
s
->
name
);
switch
(
s
->
type
)
{
default:
if
((
s
->
type
&~
SSUB
)
!=
STEXT
)
{
/* diag prints TNAME first */
diag
(
"undefined: %s"
,
s
->
name
);
s
->
type
=
STEXT
;
s
->
value
=
vexit
;
continue
;
// avoid more error messages
case
STEXT
:
p
->
to
.
offset
=
s
->
value
;
break
;
}
if
(
s
->
text
==
nil
)
continue
;
p
->
to
.
type
=
D_BRANCH
;
p
->
to
.
offset
=
s
->
text
->
pc
;
p
->
pcond
=
s
->
text
;
continue
;
}
}
if
(
p
->
to
.
type
!=
D_BRANCH
)
continue
;
c
=
p
->
to
.
offset
;
for
(
q
=
textp
->
text
;
q
!=
P
;)
{
for
(
q
=
cursym
->
text
;
q
!=
P
;)
{
if
(
c
==
q
->
pc
)
break
;
if
(
q
->
forwd
!=
P
&&
c
>=
q
->
forwd
->
pc
)
...
...
@@ -315,8 +316,8 @@ patch(void)
q
=
q
->
link
;
}
if
(
q
==
P
)
{
diag
(
"branch out of range in %s
\n
%P [%s]"
,
TNAME
,
p
,
p
->
to
.
sym
?
p
->
to
.
sym
->
name
:
"<nil>"
);
diag
(
"branch out of range in %s
(%#ux)
\n
%P [%s]"
,
TNAME
,
c
,
p
,
p
->
to
.
sym
?
p
->
to
.
sym
->
name
:
"<nil>"
);
p
->
to
.
type
=
D_NONE
;
}
p
->
pcond
=
q
;
...
...
@@ -387,6 +388,9 @@ dostkoff(void)
autoffset
=
0
;
deltasp
=
0
;
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
if
(
cursym
->
text
==
nil
||
cursym
->
text
->
link
==
nil
)
continue
;
p
=
cursym
->
text
;
parsetextconst
(
p
->
to
.
offset
);
autoffset
=
textstksiz
;
...
...
src/cmd/6l/span.c
View file @
8132f1d0
...
...
@@ -138,9 +138,7 @@ span(void)
{
Prog
*
p
,
*
q
;
int32
v
;
vlong
c
;
int
n
;
Section
*
sect
;
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f span
\n
"
,
cputime
());
...
...
@@ -176,20 +174,6 @@ span(void)
}
span1
(
cursym
);
}
// Next, loop over symbols to assign actual PCs.
// Could parallelize here too, by assigning to text
// and then letting threads copy down, but probably not worth it.
c
=
INITTEXT
;
sect
=
addsection
(
&
segtext
,
".text"
,
05
);
sect
->
vaddr
=
c
;
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
cursym
->
value
=
c
;
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
p
->
pc
+=
c
;
c
+=
cursym
->
size
;
}
sect
->
len
=
c
-
sect
->
vaddr
;
}
void
...
...
@@ -1435,7 +1419,7 @@ found:
// Could handle this case by making D_PCREL
// record the Prog* instead of the Sym*, but let's
// wait until the need arises.
diag
(
"call of non-TEXT
"
);
diag
(
"call of non-TEXT
%P"
,
q
);
errorexit
();
}
*
andptr
++
=
op
;
...
...
src/cmd/8l/obj.c
View file @
8132f1d0
...
...
@@ -329,6 +329,7 @@ main(int argc, char *argv[])
else
doprof2
();
span
();
textaddress
();
pclntab
();
symtab
();
dodata
();
...
...
src/cmd/8l/pass.c
View file @
8132f1d0
...
...
@@ -306,24 +306,25 @@ patch(void)
if
(
s
)
{
if
(
debug
[
'c'
])
Bprint
(
&
bso
,
"%s calls %s
\n
"
,
TNAME
,
s
->
name
);
switch
(
s
->
type
)
{
default:
if
((
s
->
type
&~
SSUB
)
!=
STEXT
)
{
/* diag prints TNAME first */
diag
(
"undefined: %s"
,
s
->
name
);
s
->
type
=
STEXT
;
s
->
value
=
vexit
;
continue
;
// avoid more error messages
case
STEXT
:
p
->
to
.
offset
=
s
->
value
;
break
;
}
if
(
s
->
text
==
nil
)
continue
;
p
->
to
.
type
=
D_BRANCH
;
p
->
to
.
offset
=
s
->
text
->
pc
;
p
->
pcond
=
s
->
text
;
continue
;
}
}
if
(
p
->
to
.
type
!=
D_BRANCH
)
continue
;
c
=
p
->
to
.
offset
;
for
(
q
=
textp
->
text
;
q
!=
P
;)
{
for
(
q
=
cursym
->
text
;
q
!=
P
;)
{
if
(
c
==
q
->
pc
)
break
;
if
(
q
->
forwd
!=
P
&&
c
>=
q
->
forwd
->
pc
)
...
...
@@ -332,7 +333,8 @@ patch(void)
q
=
q
->
link
;
}
if
(
q
==
P
)
{
diag
(
"branch out of range in %s
\n
%P"
,
TNAME
,
p
);
diag
(
"branch out of range in %s (%#ux)
\n
%P [%s]"
,
TNAME
,
c
,
p
,
p
->
to
.
sym
?
p
->
to
.
sym
->
name
:
"<nil>"
);
p
->
to
.
type
=
D_NONE
;
}
p
->
pcond
=
q
;
...
...
@@ -340,6 +342,9 @@ patch(void)
}
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
if
(
cursym
->
text
==
nil
||
cursym
->
p
!=
nil
)
continue
;
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
{
p
->
mark
=
0
;
/* initialization for follow */
if
(
p
->
pcond
!=
P
)
{
...
...
@@ -389,8 +394,10 @@ dostkoff(void)
}
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
p
=
cursym
->
text
;
if
(
cursym
->
text
==
nil
||
cursym
->
text
->
link
==
nil
)
continue
;
p
=
cursym
->
text
;
autoffset
=
p
->
to
.
offset
;
if
(
autoffset
<
0
)
autoffset
=
0
;
...
...
@@ -639,5 +646,5 @@ undef(void)
for
(
i
=
0
;
i
<
NHASH
;
i
++
)
for
(
s
=
hash
[
i
];
s
!=
S
;
s
=
s
->
hash
)
if
(
s
->
type
==
SXREF
)
diag
(
"%s
: not defined"
,
s
->
name
);
diag
(
"%s
(%d): not defined"
,
s
->
name
,
s
->
version
);
}
src/cmd/8l/span.c
View file @
8132f1d0
...
...
@@ -132,9 +132,8 @@ void
span
(
void
)
{
Prog
*
p
,
*
q
;
int32
v
,
c
;
int32
v
;
int
n
;
Section
*
sect
;
if
(
debug
[
'v'
])
Bprint
(
&
bso
,
"%5.2f span
\n
"
,
cputime
());
...
...
@@ -142,6 +141,9 @@ span(void)
// NOTE(rsc): If we get rid of the globals we should
// be able to parallelize these iterations.
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
if
(
cursym
->
text
==
nil
||
cursym
->
text
->
link
==
nil
)
continue
;
// TODO: move into span1
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
{
n
=
0
;
...
...
@@ -168,20 +170,6 @@ span(void)
}
span1
(
cursym
);
}
// Next, loop over symbols to assign actual PCs.
// Could parallelize here too, by assigning to text
// and then letting threads copy down, but probably not worth it.
c
=
INITTEXT
;
sect
=
addsection
(
&
segtext
,
".text"
,
05
);
sect
->
vaddr
=
c
;
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
cursym
->
value
=
c
;
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
p
->
pc
+=
c
;
c
+=
cursym
->
size
;
}
sect
->
len
=
c
-
sect
->
vaddr
;
}
void
...
...
@@ -1118,7 +1106,7 @@ found:
// Could handle this case by making D_PCREL
// record the Prog* instead of the Sym*, but let's
// wait until the need arises.
diag
(
"call of non-TEXT
"
);
diag
(
"call of non-TEXT
%P"
,
q
);
errorexit
();
}
*
andptr
++
=
op
;
...
...
src/cmd/ld/dwarf.c
View file @
8132f1d0
...
...
@@ -1895,7 +1895,7 @@ writelines(void)
cput
(
DW_LNE_set_address
);
addrput
(
pc
);
}
if
(
!
s
->
reachable
)
if
(
s
->
text
==
nil
)
continue
;
if
(
unitstart
<
0
)
{
...
...
@@ -1910,6 +1910,9 @@ writelines(void)
if
(
s
->
version
==
0
)
newattr
(
dwfunc
,
DW_AT_external
,
DW_CLS_FLAG
,
1
,
0
);
if
(
s
->
text
->
link
==
nil
)
continue
;
for
(
q
=
s
->
text
;
q
!=
P
;
q
=
q
->
link
)
{
lh
=
searchhist
(
q
->
line
);
if
(
lh
==
nil
)
{
...
...
@@ -2054,7 +2057,7 @@ writeframes(void)
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
s
=
cursym
;
if
(
!
s
->
reachable
)
if
(
s
->
text
==
nil
)
continue
;
fdeo
=
cpos
();
...
...
src/cmd/ld/elf.h
View file @
8132f1d0
...
...
@@ -964,7 +964,7 @@ extern int numelfshdr;
extern
int
iself
;
int
elfwriteinterp
(
void
);
void
elfinterp
(
ElfShdr
*
,
uint64
,
char
*
);
void
elfdynhash
(
int
);
void
elfdynhash
(
void
);
ElfPhdr
*
elfphload
(
Segment
*
);
ElfShdr
*
elfshbits
(
Section
*
);
void
elfsetstring
(
char
*
,
int
);
...
...
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