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
14eba969
Commit
14eba969
authored
Jul 21, 2011
by
Gustavo Niemeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ld: fix freebsd build reverting .interp move
R=golang-dev, r CC=golang-dev
https://golang.org/cl/4794046
parent
8cdee891
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
47 deletions
+46
-47
src/cmd/5l/asm.c
src/cmd/5l/asm.c
+4
-10
src/cmd/6l/asm.c
src/cmd/6l/asm.c
+2
-18
src/cmd/8l/asm.c
src/cmd/8l/asm.c
+12
-18
src/cmd/ld/data.c
src/cmd/ld/data.c
+1
-1
src/cmd/ld/elf.c
src/cmd/ld/elf.c
+27
-0
No files found.
src/cmd/5l/asm.c
View file @
14eba969
...
...
@@ -185,14 +185,6 @@ doelf(void)
elfstr
[
ElfStrRelPlt
]
=
addstring
(
shstrtab
,
".rel.plt"
);
elfstr
[
ElfStrPlt
]
=
addstring
(
shstrtab
,
".plt"
);
/* interpreter string */
if
(
interpreter
==
nil
)
interpreter
=
linuxdynld
;
s
=
lookup
(
".interp"
,
0
);
s
->
type
=
SELFROSECT
;
s
->
reachable
=
1
;
addstring
(
s
,
interpreter
);
/* dynamic symbol table - first entry all zeros */
s
=
lookup
(
".dynsym"
,
0
);
s
->
type
=
SELFROSECT
;
...
...
@@ -492,7 +484,9 @@ asmb(void)
sh
->
type
=
SHT_PROGBITS
;
sh
->
flags
=
SHF_ALLOC
;
sh
->
addralign
=
1
;
shsym
(
sh
,
lookup
(
".interp"
,
0
));
if
(
interpreter
==
nil
)
interpreter
=
linuxdynld
;
elfinterp
(
sh
,
startva
,
interpreter
);
ph
=
newElfPhdr
();
ph
->
type
=
PT_INTERP
;
...
...
@@ -638,7 +632,7 @@ asmb(void)
a
+=
elfwritephdrs
();
a
+=
elfwriteshdrs
();
cflush
();
if
(
a
>
ELFRESERVE
)
if
(
a
+
elfwriteinterp
()
>
ELFRESERVE
)
diag
(
"ELFRESERVE too small: %d > %d"
,
a
,
ELFRESERVE
);
break
;
}
...
...
src/cmd/6l/asm.c
View file @
14eba969
...
...
@@ -591,22 +591,6 @@ doelf(void)
elfstr
[
ElfStrGnuVersion
]
=
addstring
(
shstrtab
,
".gnu.version"
);
elfstr
[
ElfStrGnuVersionR
]
=
addstring
(
shstrtab
,
".gnu.version_r"
);
/* interpreter string */
if
(
interpreter
==
nil
)
{
switch
(
HEADTYPE
)
{
case
Hlinux
:
interpreter
=
linuxdynld
;
break
;
case
Hfreebsd
:
interpreter
=
freebsddynld
;
break
;
}
}
s
=
lookup
(
".interp"
,
0
);
s
->
type
=
SELFROSECT
;
s
->
reachable
=
1
;
addstring
(
s
,
interpreter
);
/* dynamic symbol table - first entry all zeros */
s
=
lookup
(
".dynsym"
,
0
);
s
->
type
=
SELFROSECT
;
...
...
@@ -909,7 +893,7 @@ asmb(void)
break
;
}
}
shsym
(
sh
,
lookup
(
".interp"
,
0
)
);
elfinterp
(
sh
,
startva
,
interpreter
);
ph
=
newElfPhdr
();
ph
->
type
=
PT_INTERP
;
...
...
@@ -1088,7 +1072,7 @@ asmb(void)
a
+=
elfwritephdrs
();
a
+=
elfwriteshdrs
();
cflush
();
if
(
a
>
ELFRESERVE
)
if
(
a
+
elfwriteinterp
()
>
ELFRESERVE
)
diag
(
"ELFRESERVE too small: %d > %d"
,
a
,
ELFRESERVE
);
break
;
case
Hwindows
:
...
...
src/cmd/8l/asm.c
View file @
14eba969
...
...
@@ -551,22 +551,6 @@ doelf(void)
elfstr
[
ElfStrGnuVersion
]
=
addstring
(
shstrtab
,
".gnu.version"
);
elfstr
[
ElfStrGnuVersionR
]
=
addstring
(
shstrtab
,
".gnu.version_r"
);
/* interpreter string */
if
(
interpreter
==
nil
)
{
switch
(
HEADTYPE
)
{
case
Hlinux
:
interpreter
=
linuxdynld
;
break
;
case
Hfreebsd
:
interpreter
=
freebsddynld
;
break
;
}
}
s
=
lookup
(
".interp"
,
0
);
s
->
type
=
SELFROSECT
;
s
->
reachable
=
1
;
addstring
(
s
,
interpreter
);
/* dynamic symbol table - first entry all zeros */
s
=
lookup
(
".dynsym"
,
0
);
s
->
type
=
SELFROSECT
;
...
...
@@ -964,7 +948,17 @@ asmb(void)
sh
->
type
=
SHT_PROGBITS
;
sh
->
flags
=
SHF_ALLOC
;
sh
->
addralign
=
1
;
shsym
(
sh
,
lookup
(
".interp"
,
0
));
if
(
interpreter
==
nil
)
{
switch
(
HEADTYPE
)
{
case
Hlinux
:
interpreter
=
linuxdynld
;
break
;
case
Hfreebsd
:
interpreter
=
freebsddynld
;
break
;
}
}
elfinterp
(
sh
,
startva
,
interpreter
);
ph
=
newElfPhdr
();
ph
->
type
=
PT_INTERP
;
...
...
@@ -1148,7 +1142,7 @@ asmb(void)
a
+=
elfwritephdrs
();
a
+=
elfwriteshdrs
();
cflush
();
if
(
a
>
ELFRESERVE
)
if
(
a
+
elfwriteinterp
()
>
ELFRESERVE
)
diag
(
"ELFRESERVE too small: %d > %d"
,
a
,
ELFRESERVE
);
break
;
...
...
src/cmd/ld/data.c
View file @
14eba969
...
...
@@ -871,7 +871,7 @@ dodata(void)
/* data */
sect
=
addsection
(
&
segdata
,
".data"
,
06
);
sect
->
vaddr
=
0
;
sect
->
vaddr
=
datsize
;
for
(;
s
!=
nil
&&
s
->
type
<
SBSS
;
s
=
s
->
next
)
{
s
->
type
=
SDATA
;
t
=
s
->
size
;
...
...
src/cmd/ld/elf.c
View file @
14eba969
...
...
@@ -19,6 +19,7 @@ static int elf64;
static
ElfEhdr
hdr
;
static
ElfPhdr
*
phdr
[
NSECT
];
static
ElfShdr
*
shdr
[
NSECT
];
static
char
*
interp
;
typedef
struct
Elfstring
Elfstring
;
struct
Elfstring
...
...
@@ -303,6 +304,32 @@ elfwritedynentsymsize(Sym *s, int tag, Sym *t)
addsize
(
s
,
t
);
}
int
elfwriteinterp
(
void
)
{
int
n
;
if
(
interp
==
nil
)
return
0
;
n
=
strlen
(
interp
)
+
1
;
cseek
(
ELFRESERVE
-
n
);
cwrite
(
interp
,
n
);
return
n
;
}
void
elfinterp
(
ElfShdr
*
sh
,
uint64
startva
,
char
*
p
)
{
int
n
;
interp
=
p
;
n
=
strlen
(
interp
)
+
1
;
sh
->
addr
=
startva
+
ELFRESERVE
-
n
;
sh
->
off
=
ELFRESERVE
-
n
;
sh
->
size
=
n
;
}
extern
int
nelfsym
;
int
elfverneed
;
...
...
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