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
01464cf9
Commit
01464cf9
authored
Dec 17, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ld: allow relocations pointing at ELF .bss symbols
R=r, r2 CC=golang-dev
https://golang.org/cl/3710042
parent
0cd34753
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
ldelf.c
src/cmd/ld/ldelf.c
+9
-16
No files found.
src/cmd/ld/ldelf.c
View file @
01464cf9
...
@@ -322,7 +322,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
...
@@ -322,7 +322,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
uchar
*
p
,
*
dp
;
uchar
*
p
,
*
dp
;
ElfHdrBytes
*
hdr
;
ElfHdrBytes
*
hdr
;
ElfObj
*
obj
;
ElfObj
*
obj
;
ElfSect
*
sect
,
*
rsect
,
*
text
,
*
data
,
*
bss
,
*
rodata
;
ElfSect
*
sect
,
*
rsect
;
ElfSym
sym
;
ElfSym
sym
;
Endian
*
e
;
Endian
*
e
;
Reloc
*
r
,
*
rp
;
Reloc
*
r
,
*
rp
;
...
@@ -506,23 +506,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
...
@@ -506,23 +506,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
// they are not as small as the section lists, but we'll need
// they are not as small as the section lists, but we'll need
// the memory anyway for the symbol images, so we might
// the memory anyway for the symbol images, so we might
// as well use one large chunk.
// as well use one large chunk.
text
=
section
(
obj
,
".text"
);
if
(
text
&&
map
(
obj
,
text
)
<
0
)
goto
bad
;
data
=
section
(
obj
,
".data"
);
if
(
data
&&
map
(
obj
,
data
)
<
0
)
goto
bad
;
bss
=
section
(
obj
,
".bss"
);
rodata
=
section
(
obj
,
".rodata"
);
if
(
rodata
&&
map
(
obj
,
rodata
)
<
0
)
goto
bad
;
// create symbols for mapped sections
// create symbols for mapped sections
for
(
i
=
0
;
i
<
obj
->
nsect
;
i
++
)
{
for
(
i
=
0
;
i
<
obj
->
nsect
;
i
++
)
{
sect
=
&
obj
->
sect
[
i
];
sect
=
&
obj
->
sect
[
i
];
if
(
sect
->
type
!=
ElfSectProgbits
||
!
(
sect
->
flags
&
ElfSectFlagAlloc
))
if
(
(
sect
->
type
!=
ElfSectProgbits
&&
sect
->
type
!=
ElfSectNobits
)
||
!
(
sect
->
flags
&
ElfSectFlagAlloc
))
continue
;
continue
;
if
(
map
(
obj
,
sect
)
<
0
)
if
(
sect
->
type
!=
ElfSectNobits
&&
map
(
obj
,
sect
)
<
0
)
goto
bad
;
goto
bad
;
name
=
smprint
(
"%s(%s)"
,
pn
,
sect
->
name
);
name
=
smprint
(
"%s(%s)"
,
pn
,
sect
->
name
);
...
@@ -542,8 +532,10 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
...
@@ -542,8 +532,10 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
s
->
type
=
STEXT
;
s
->
type
=
STEXT
;
break
;
break
;
}
}
s
->
p
=
sect
->
base
;
if
(
sect
->
type
==
ElfSectProgbits
)
{
s
->
np
=
sect
->
size
;
s
->
p
=
sect
->
base
;
s
->
np
=
sect
->
size
;
}
s
->
size
=
sect
->
size
;
s
->
size
=
sect
->
size
;
if
(
s
->
type
==
STEXT
)
{
if
(
s
->
type
==
STEXT
)
{
if
(
etextp
)
if
(
etextp
)
...
@@ -598,7 +590,8 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
...
@@ -598,7 +590,8 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
if
(
readsym
(
obj
,
info
>>
32
,
&
sym
)
<
0
)
if
(
readsym
(
obj
,
info
>>
32
,
&
sym
)
<
0
)
goto
bad
;
goto
bad
;
if
(
sym
.
sym
==
nil
)
{
if
(
sym
.
sym
==
nil
)
{
werrstr
(
"reloc of invalid sym %s shndx=%d type=%d"
,
sym
.
name
,
sym
.
shndx
,
sym
.
type
);
werrstr
(
"%s#%d: reloc of invalid sym #%d %s shndx=%d type=%d"
,
sect
->
sym
->
name
,
j
,
(
int
)(
info
>>
32
),
sym
.
name
,
sym
.
shndx
,
sym
.
type
);
goto
bad
;
goto
bad
;
}
}
rp
->
sym
=
sym
.
sym
;
rp
->
sym
=
sym
.
sym
;
...
...
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