Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
825dad89
Commit
825dad89
authored
Nov 01, 2005
by
Andreas Schwab
Browse files
(unexec): Handle .plt section in BSS segment.
parent
cf7ec6c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
src/unexelf.c
src/unexelf.c
+23
-4
No files found.
src/unexelf.c
View file @
825dad89
...
...
@@ -682,7 +682,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
ElfW
(
Addr
)
new_data2_addr
;
int
n
,
nn
;
int
old_bss_index
,
old_sbss_index
;
int
old_bss_index
,
old_sbss_index
,
old_plt_index
;
int
old_data_index
,
new_data2_index
;
int
old_mdebug_index
;
struct
stat
stat_buf
;
...
...
@@ -740,15 +740,34 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
old_sbss_index
=
find_section
(
".sbss"
,
old_section_names
,
old_name
,
old_file_h
,
old_section_h
,
1
);
if
(
old_sbss_index
!=
-
1
)
if
(
OLD_SECTION_H
(
old_sbss_index
).
sh_type
=
=
SHT_
PROG
BITS
)
if
(
OLD_SECTION_H
(
old_sbss_index
).
sh_type
!
=
SHT_
NO
BITS
)
old_sbss_index
=
-
1
;
if
(
old_sbss_index
==
-
1
)
/* PowerPC64 has .plt in the BSS section. */
old_plt_index
=
find_section
(
".plt"
,
old_section_names
,
old_name
,
old_file_h
,
old_section_h
,
1
);
if
(
old_plt_index
!=
-
1
)
if
(
OLD_SECTION_H
(
old_plt_index
).
sh_type
!=
SHT_NOBITS
)
old_plt_index
=
-
1
;
if
(
old_sbss_index
==
-
1
&&
old_plt_index
==
-
1
)
{
old_bss_addr
=
OLD_SECTION_H
(
old_bss_index
).
sh_addr
;
old_bss_size
=
OLD_SECTION_H
(
old_bss_index
).
sh_size
;
new_data2_index
=
old_bss_index
;
}
else
if
(
old_plt_index
!=
-
1
&&
(
old_sbss_index
==
-
1
||
(
OLD_SECTION_H
(
old_sbss_index
).
sh_addr
>
OLD_SECTION_H
(
old_plt_index
).
sh_addr
)))
{
old_bss_addr
=
OLD_SECTION_H
(
old_plt_index
).
sh_addr
;
old_bss_size
=
OLD_SECTION_H
(
old_bss_index
).
sh_size
+
OLD_SECTION_H
(
old_plt_index
).
sh_size
;
if
(
old_sbss_index
!=
-
1
)
old_bss_size
+=
OLD_SECTION_H
(
old_sbss_index
).
sh_size
;
new_data2_index
=
old_plt_index
;
}
else
{
old_bss_addr
=
OLD_SECTION_H
(
old_sbss_index
).
sh_addr
;
...
...
@@ -934,7 +953,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
if
(
n
==
old_bss_index
/* The new bss and sbss section's size is zero, and its file offset
and virtual address should be off by NEW_DATA2_SIZE. */
||
n
==
old_sbss_index
||
n
==
old_sbss_index
||
n
==
old_plt_index
)
{
/* NN should be `old_s?bss_index + 1' at this point. */
...
...
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