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
bf43161c
Commit
bf43161c
authored
Nov 30, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ld: align ELF data sections
fixes #2506 R=rsc, iant CC=golang-dev
https://golang.org/cl/5440066
parent
97197a62
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
2 deletions
+18
-2
src/cmd/5l/l.h
src/cmd/5l/l.h
+1
-0
src/cmd/6l/l.h
src/cmd/6l/l.h
+1
-0
src/cmd/8l/l.h
src/cmd/8l/l.h
+1
-0
src/cmd/ld/data.c
src/cmd/ld/data.c
+14
-2
src/cmd/ld/ldelf.c
src/cmd/ld/ldelf.c
+1
-0
No files found.
src/cmd/5l/l.h
View file @
bf43161c
...
...
@@ -143,6 +143,7 @@ struct Sym
int32
value
;
int32
sig
;
int32
size
;
int32
align
;
// if non-zero, required alignment in bytes
uchar
special
;
uchar
fnptr
;
// used as fn ptr
Sym
*
hash
;
// in hash table
...
...
src/cmd/6l/l.h
View file @
bf43161c
...
...
@@ -133,6 +133,7 @@ struct Sym
int32
sig
;
int32
plt
;
int32
got
;
int32
align
;
// if non-zero, required alignment in bytes
Sym
*
hash
;
// in hash table
Sym
*
allsym
;
// in all symbol list
Sym
*
next
;
// in text or data list
...
...
src/cmd/8l/l.h
View file @
bf43161c
...
...
@@ -134,6 +134,7 @@ struct Sym
int32
dynid
;
int32
plt
;
int32
got
;
int32
align
;
// if non-zero, required alignment in bytes
Sym
*
hash
;
// in hash table
Sym
*
allsym
;
// in all symbol list
Sym
*
next
;
// in text or data list
...
...
src/cmd/ld/data.c
View file @
bf43161c
...
...
@@ -824,6 +824,8 @@ dodata(void)
datsize
=
0
;
s
=
datap
;
for
(;
s
!=
nil
&&
s
->
type
<
SSYMTAB
;
s
=
s
->
next
)
{
if
(
s
->
align
!=
0
)
datsize
=
rnd
(
datsize
,
s
->
align
);
s
->
type
=
SRODATA
;
s
->
value
=
datsize
;
datsize
+=
rnd
(
s
->
size
,
PtrSize
);
...
...
@@ -855,6 +857,8 @@ dodata(void)
/* read-only ELF sections */
for
(;
s
!=
nil
&&
s
->
type
<
SELFSECT
;
s
=
s
->
next
)
{
sect
=
addsection
(
&
segtext
,
s
->
name
,
04
);
if
(
s
->
align
!=
0
)
datsize
=
rnd
(
datsize
,
s
->
align
);
sect
->
vaddr
=
datsize
;
s
->
type
=
SRODATA
;
s
->
value
=
datsize
;
...
...
@@ -866,6 +870,8 @@ dodata(void)
datsize
=
0
;
for
(;
s
!=
nil
&&
s
->
type
<
SDATA
;
s
=
s
->
next
)
{
sect
=
addsection
(
&
segdata
,
s
->
name
,
06
);
if
(
s
->
align
!=
0
)
datsize
=
rnd
(
datsize
,
s
->
align
);
sect
->
vaddr
=
datsize
;
s
->
type
=
SDATA
;
s
->
value
=
datsize
;
...
...
@@ -887,7 +893,9 @@ dodata(void)
t
=
rnd
(
t
,
PtrSize
);
else
if
(
t
>
2
)
t
=
rnd
(
t
,
4
);
if
(
t
&
1
)
{
if
(
s
->
align
!=
0
)
datsize
=
rnd
(
datsize
,
s
->
align
);
else
if
(
t
&
1
)
{
;
}
else
if
(
t
&
2
)
datsize
=
rnd
(
datsize
,
2
);
...
...
@@ -913,7 +921,9 @@ dodata(void)
t
=
rnd
(
t
,
PtrSize
);
else
if
(
t
>
2
)
t
=
rnd
(
t
,
4
);
if
(
t
&
1
)
{
if
(
s
->
align
!=
0
)
datsize
=
rnd
(
datsize
,
s
->
align
);
else
if
(
t
&
1
)
{
;
}
else
if
(
t
&
2
)
datsize
=
rnd
(
datsize
,
2
);
...
...
@@ -947,6 +957,8 @@ textaddress(void)
for
(
sym
=
textp
;
sym
!=
nil
;
sym
=
sym
->
next
)
{
if
(
sym
->
type
&
SSUB
)
continue
;
if
(
sym
->
align
!=
0
)
va
=
rnd
(
va
,
sym
->
align
);
sym
->
value
=
0
;
for
(
sub
=
sym
;
sub
!=
S
;
sub
=
sub
->
sub
)
{
sub
->
value
+=
va
;
...
...
src/cmd/ld/ldelf.c
View file @
bf43161c
...
...
@@ -538,6 +538,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
s
->
np
=
sect
->
size
;
}
s
->
size
=
sect
->
size
;
s
->
align
=
sect
->
align
;
if
(
s
->
type
==
STEXT
)
{
if
(
etextp
)
etextp
->
next
=
s
;
...
...
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