Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zipr_push64_reloc_plugin
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
Container Registry
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Open Source Software
zipr_push64_reloc_plugin
Commits
356757cf
Commit
356757cf
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
refactored to deal with options better
parent
2ca8f310
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
push64_relocs.cpp
+14
-21
14 additions, 21 deletions
push64_relocs.cpp
push64_relocs.h
+4
-5
4 additions, 5 deletions
push64_relocs.h
with
18 additions
and
26 deletions
push64_relocs.cpp
+
14
−
21
View file @
356757cf
...
...
@@ -39,18 +39,14 @@ using namespace std;
#define ALLOF(a) begin(a), end(a)
Push64Relocs_t
::
Push64Relocs_t
(
MemorySpace_t
*
p_ms
,
FileIR_t
*
p_firp
,
InstructionLocationMap_t
*
p_fil
)
:
m_memory_space
(
*
p_ms
),
m_firp
(
*
p_firp
),
final_insn_locations
(
*
p_fil
),
m_verbose
(
"verbose"
)
Push64Relocs_t
::
Push64Relocs_t
(
Zipr_SDK
::
Zipr_t
*
zipr_object
)
:
m_memory_space
(
*
zipr_object
->
getMemorySpace
()),
m_firp
(
*
zipr_object
->
getFileIR
()),
final_insn_locations
(
*
zipr_object
->
getLocationMap
())
{
}
ZiprOptionsNamespace_t
*
Push64Relocs_t
::
registerOptions
(
ZiprOptionsNamespace_t
*
global
)
{
global
->
addOption
(
&
m_verbose
);
return
NULL
;
auto
global
=
zipr_object
->
getOptionsManager
()
->
getNamespace
(
"global"
);
m_verbose
=
global
->
getBooleanOption
(
"verbose"
);
}
bool
Push64Relocs_t
::
IsRelocationWithType
(
Relocation_t
*
reloc
,
std
::
string
type
)
...
...
@@ -99,7 +95,7 @@ void Push64Relocs_t::HandlePush64Relocation(Instruction_t *insn, Relocation_t *r
*/
push_addr
=
*
((
VirtualOffset_t
*
)(
&
push_data_bits
[
1
]));
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"push_addr: 0x"
<<
std
::
hex
<<
push_addr
<<
endl
;
assert
(
push_addr
!=
0
);
...
...
@@ -149,7 +145,7 @@ void Push64Relocs_t::HandlePush64Relocation(Instruction_t *insn, Relocation_t *r
*/
auto
add_reloc
=
m_firp
.
addNewRelocation
(
add_insn
,
push_addr
,
"add64"
);
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"Adding an add/sub with reloc offset 0x"
<<
std
::
hex
<<
add_reloc
->
getOffset
()
<<
endl
;
...
...
@@ -173,7 +169,7 @@ void Push64Relocs_t::HandlePush64Relocs()
// caution, side effect in if statement.
if
(
reloc
=
FindPushRelocation
(
insn
))
{
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"Found a Push relocation:"
<<
insn
->
getDisassembly
()
<<
endl
;
HandlePush64Relocation
(
insn
,
reloc
);
push64_relocations_count
++
;
...
...
@@ -181,7 +177,7 @@ void Push64Relocs_t::HandlePush64Relocs()
// caution, side effect in if statement.
else
if
(
reloc
=
FindPcrelRelocation
(
insn
))
{
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"Found a pcrel relocation."
<<
endl
;
plopped_relocs
.
insert
(
insn
);
pcrel_relocations_count
++
;
...
...
@@ -199,7 +195,7 @@ void Push64Relocs_t::HandlePush64Relocs()
void
Push64Relocs_t
::
UpdatePush64Adds
()
{
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"push64:UpdatePush64Adds()"
<<
endl
;
InstructionSet_t
::
iterator
insn_it
=
plopped_relocs
.
begin
();
for
(
insn_it
;
insn_it
!=
plopped_relocs
.
end
();
insn_it
++
)
...
...
@@ -232,7 +228,7 @@ void Push64Relocs_t::UpdatePush64Adds()
if
(
call_addr
==
0
||
add_addr
==
0
)
{
if
(
m_verbose
)
if
(
*
m_verbose
)
cout
<<
"push64:Call/Add pair not plopped?"
<<
endl
;
continue
;
}
...
...
@@ -291,8 +287,5 @@ extern "C"
Zipr_SDK
::
ZiprPluginInterface_t
*
GetPluginInterface
(
Zipr_SDK
::
Zipr_t
*
zipr_object
)
{
auto
*
p_ms
=
zipr_object
->
getMemorySpace
();
auto
*
p_firp
=
zipr_object
->
getFileIR
();
auto
*
p_fil
=
zipr_object
->
getLocationMap
();
return
new
Push64Relocs_t
(
p_ms
,
p_firp
,
p_fil
);
return
new
Push64Relocs_t
(
zipr_object
);
}
This diff is collapsed.
Click to expand it.
push64_relocs.h
+
4
−
5
View file @
356757cf
...
...
@@ -37,9 +37,8 @@
class
Push64Relocs_t
:
public
Zipr_SDK
::
ZiprPluginInterface_t
{
public:
Push64Relocs_t
(
Zipr_SDK
::
MemorySpace_t
*
p_ms
,
IRDB_SDK
::
FileIR_t
*
p_firp
,
Zipr_SDK
::
InstructionLocationMap_t
*
p_fil
);
Push64Relocs_t
(
Zipr_SDK
::
Zipr_t
*
zipr_object
);
virtual
void
doPinningEnd
()
override
{
// if(m_elfio.get_type()==ET_EXEC)
...
...
@@ -63,7 +62,7 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
UpdatePush64Adds
();
}
virtual
Zipr_SDK
::
ZiprOptionsNamespace_t
*
registerOptions
(
Zipr_SDK
::
ZiprOptionsNamespace_t
*
)
override
;
//
virtual Zipr_SDK::ZiprOptionsNamespace_t *registerOptions(Zipr_SDK::ZiprOptionsNamespace_t *) override;
private
:
// main workhorses
void
HandlePush64Relocs
();
...
...
@@ -119,7 +118,7 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
// local data.
IRDB_SDK
::
InstructionSet_t
plopped_relocs
;
Zipr_SDK
::
ZiprBooleanOption_t
m_verbose
;
Zipr_SDK
::
ZiprBooleanOption_t
*
m_verbose
;
};
...
...
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