Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
48240339
Commit
48240339
authored
Jan 08, 1996
by
Karl Heuer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(unexec) [SOLARIS2]: Undo relocations performed by the
runtime linker.
parent
449decf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
src/unexelf.c
src/unexelf.c
+34
-0
No files found.
src/unexelf.c
View file @
48240339
...
...
@@ -807,6 +807,40 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
memcpy
(
&
symp
->
st_value
,
&
new_bss_addr
,
sizeof
(
new_bss_addr
));
}
#ifdef SOLARIS2
/* This loop seeks out relocation sections for the data section, so
that it can undo relocations performed by the runtime linker. */
for
(
n
=
new_file_h
->
e_shnum
-
1
;
n
;
n
--
)
{
Elf32_Shdr
section
=
NEW_SECTION_H
(
n
);
switch
(
section
.
sh_type
)
{
default:
break
;
case
SHT_REL
:
case
SHT_RELA
:
/* This code handles two different size structs, but there
should be no harm in that provided that r_offset is always
the first member. */
nn
=
section
.
sh_info
;
if
(
!
strcmp
(
old_section_names
+
NEW_SECTION_H
(
nn
).
sh_name
,
".data"
)
||
!
strcmp
((
old_section_names
+
NEW_SECTION_H
(
nn
).
sh_name
),
".data1"
))
{
Elf32_Addr
offset
=
NEW_SECTION_H
(
nn
).
sh_addr
-
NEW_SECTION_H
(
nn
).
sh_offset
;
caddr_t
reloc
=
old_base
+
section
.
sh_offset
,
end
;
for
(
end
=
reloc
+
section
.
sh_size
;
reloc
<
end
;
reloc
+=
section
.
sh_entsize
)
{
Elf32_Addr
addr
=
((
Elf32_Rel
*
)
reloc
)
->
r_offset
-
offset
;
memcpy
(
new_base
+
addr
,
old_base
+
addr
,
4
);
}
}
break
;
}
}
#endif
#ifdef UNEXEC_USE_MAP_PRIVATE
if
(
lseek
(
new_file
,
0
,
SEEK_SET
)
==
-
1
)
fatal
(
"Can't rewind (%s): errno %d
\n
"
,
new_name
,
errno
);
...
...
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