Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
elfio mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Third Party Mirrors
elfio mirror
Commits
5dd8ba29
Commit
5dd8ba29
authored
11 years ago
by
Mario Werner
Browse files
Options
Downloads
Patches
Plain Diff
assign sections to the segments during load based on the offsets
parent
f78a5195
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
elfio/elfio.hpp
+12
-0
12 additions, 0 deletions
elfio/elfio.hpp
elfio/elfio_section.hpp
+8
-0
8 additions, 0 deletions
elfio/elfio_section.hpp
elfio/elfio_segment.hpp
+6
-0
6 additions, 0 deletions
elfio/elfio_segment.hpp
with
26 additions
and
0 deletions
elfio/elfio.hpp
+
12
−
0
View file @
5dd8ba29
...
@@ -378,6 +378,18 @@ class elfio
...
@@ -378,6 +378,18 @@ class elfio
seg
->
load
(
stream
,
(
std
::
streamoff
)
offset
+
i
*
entry_size
);
seg
->
load
(
stream
,
(
std
::
streamoff
)
offset
+
i
*
entry_size
);
seg
->
set_index
(
i
);
seg
->
set_index
(
i
);
// add sections to the segments based on the load address
Elf64_Off
segBaseOffset
=
seg
->
get_offset
();
Elf64_Off
segEndOffset
=
segBaseOffset
+
seg
->
get_memory_size
();
Elf_Half
sec_num
=
sections
.
size
();
for
(
Elf_Half
j
=
0
;
j
<
sec_num
;
++
j
)
{
const
section
*
psec
=
sections
[
j
];
Elf64_Off
secOffset
=
psec
->
get_offset
();
if
(
segBaseOffset
<=
secOffset
&&
secOffset
<
segEndOffset
)
seg
->
add_section_index
(
psec
->
get_index
(),
psec
->
get_addr_align
());
}
// Add section into the segments' container
// Add section into the segments' container
segments_
.
push_back
(
seg
);
segments_
.
push_back
(
seg
);
}
}
...
...
This diff is collapsed.
Click to expand it.
elfio/elfio_section.hpp
+
8
−
0
View file @
5dd8ba29
...
@@ -54,6 +54,7 @@ class section
...
@@ -54,6 +54,7 @@ class section
virtual
void
append_data
(
const
std
::
string
&
data
)
=
0
;
virtual
void
append_data
(
const
std
::
string
&
data
)
=
0
;
protected
:
protected
:
virtual
Elf64_Off
get_offset
()
const
=
0
;
virtual
void
set_index
(
Elf_Half
)
=
0
;
virtual
void
set_index
(
Elf_Half
)
=
0
;
virtual
void
load
(
std
::
ifstream
&
f
,
virtual
void
load
(
std
::
ifstream
&
f
,
std
::
streampos
header_offset
)
=
0
;
std
::
streampos
header_offset
)
=
0
;
...
@@ -194,6 +195,13 @@ class section_impl : public section
...
@@ -194,6 +195,13 @@ class section_impl : public section
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
protected
:
protected
:
//------------------------------------------------------------------------------
Elf64_Off
get_offset
()
const
{
return
header
.
sh_offset
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
void
set_index
(
Elf_Half
value
)
set_index
(
Elf_Half
value
)
...
...
This diff is collapsed.
Click to expand it.
elfio/elfio_segment.hpp
+
6
−
0
View file @
5dd8ba29
...
@@ -134,6 +134,12 @@ class segment_impl : public segment
...
@@ -134,6 +134,12 @@ class segment_impl : public segment
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
protected
:
protected
:
//------------------------------------------------------------------------------
Elf64_Off
get_offset
()
const
{
return
ph
.
p_offset
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
void
set_index
(
Elf_Half
value
)
set_index
(
Elf_Half
value
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment