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
dc43b74e
Commit
dc43b74e
authored
Nov 18, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6l, 8l: add trivial hash table for dynamic symbols
R=r
https://golang.org/cl/156085
parent
797cc490
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
36 deletions
+42
-36
asm.c
src/cmd/6l/asm.c
+21
-18
asm.c
src/cmd/8l/asm.c
+21
-18
No files found.
src/cmd/6l/asm.c
View file @
dc43b74e
...
@@ -315,24 +315,6 @@ doelf(void)
...
@@ -315,24 +315,6 @@ doelf(void)
elfstr
[
ElfStrDynstr
]
=
addstring
(
shstrtab
,
".dynstr"
);
elfstr
[
ElfStrDynstr
]
=
addstring
(
shstrtab
,
".dynstr"
);
elfstr
[
ElfStrRela
]
=
addstring
(
shstrtab
,
".rela"
);
elfstr
[
ElfStrRela
]
=
addstring
(
shstrtab
,
".rela"
);
/*
* hash table.
* only entries that other objects need to find when
* linking us need to be in the table. right now that is
* no entries.
*
* must have at least 1 bucket, though, to avoid
* a divide by zero bug in some copies of the glibc
* dynamic loader.
*/
s
=
lookup
(
".hash"
,
0
);
s
->
type
=
SDATA
;
// TODO: rodata
s
->
reachable
=
1
;
adduint32
(
s
,
1
);
// nbucket
adduint32
(
s
,
1
);
// nchain
adduint32
(
s
,
0
);
// bucket 0
adduint32
(
s
,
0
);
// chain 0
/* dynamic symbol table - first entry all zeros */
/* dynamic symbol table - first entry all zeros */
s
=
lookup
(
".dynsym"
,
0
);
s
=
lookup
(
".dynsym"
,
0
);
s
->
type
=
SDATA
;
s
->
type
=
SDATA
;
...
@@ -393,6 +375,27 @@ doelf(void)
...
@@ -393,6 +375,27 @@ doelf(void)
}
}
}
}
/*
* hash table.
* only entries that other objects need to find when
* linking us need to be in the table. right now that is
* no entries.
*
* freebsd insists on having chains enough for all
* the local symbols, though. for now, we just lay
* down a trivial hash table with 1 bucket and a long chain,
* because no one is actually looking for our symbols.
*/
s
=
lookup
(
".hash"
,
0
);
s
->
type
=
SDATA
;
// TODO: rodata
s
->
reachable
=
1
;
adduint32
(
s
,
1
);
// nbucket
adduint32
(
s
,
nsym
);
// nchain
adduint32
(
s
,
nsym
-
1
);
// bucket 0
adduint32
(
s
,
0
);
// chain 0
for
(
h
=
1
;
h
<
nsym
;
h
++
)
// chain nsym-1 -> nsym-2 -> ... -> 2 -> 1 -> 0
adduint32
(
s
,
h
-
1
);
/*
/*
* .dynamic table
* .dynamic table
*/
*/
...
...
src/cmd/8l/asm.c
View file @
dc43b74e
...
@@ -305,24 +305,6 @@ doelf(void)
...
@@ -305,24 +305,6 @@ doelf(void)
s
->
reachable
=
1
;
s
->
reachable
=
1
;
s
->
type
=
SDATA
;
// TODO: rodata
s
->
type
=
SDATA
;
// TODO: rodata
/*
* hash table - empty for now.
* only entries that other objects need to find when
* linking us need to be in this table. right now that
* is no entries.
*
* must have at least 1 bucket, though, to avoid
* a divide by zero bug in some copies of the
* glibc dynamic loader.
*/
s
=
lookup
(
".hash"
,
0
);
s
->
type
=
SDATA
;
// TODO: rodata
s
->
reachable
=
1
;
adduint32
(
s
,
1
);
// nbucket
adduint32
(
s
,
1
);
// nchain
adduint32
(
s
,
0
);
// bucket[0]
adduint32
(
s
,
0
);
// chain[0]
/* dynamic symbol table - first entry all zeros */
/* dynamic symbol table - first entry all zeros */
s
=
lookup
(
".dynsym"
,
0
);
s
=
lookup
(
".dynsym"
,
0
);
s
->
type
=
SDATA
;
s
->
type
=
SDATA
;
...
@@ -382,6 +364,27 @@ doelf(void)
...
@@ -382,6 +364,27 @@ doelf(void)
}
}
}
}
/*
* hash table.
* only entries that other objects need to find when
* linking us need to be in the table. right now that is
* no entries.
*
* freebsd insists on having chains enough for all
* the local symbols, though. for now, we just lay
* down a trivial hash table with 1 bucket and a long chain,
* because no one is actually looking for our symbols.
*/
s
=
lookup
(
".hash"
,
0
);
s
->
type
=
SDATA
;
// TODO: rodata
s
->
reachable
=
1
;
adduint32
(
s
,
1
);
// nbucket
adduint32
(
s
,
nsym
);
// nchain
adduint32
(
s
,
nsym
-
1
);
// bucket 0
adduint32
(
s
,
0
);
// chain 0
for
(
h
=
1
;
h
<
nsym
;
h
++
)
// chain nsym-1 -> nsym-2 -> ... -> 2 -> 1 -> 0
adduint32
(
s
,
h
-
1
);
/*
/*
* .dynamic table
* .dynamic table
*/
*/
...
...
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