Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Show more breadcrumbs
Open Source Software
Zipr Toolchain
Commits
d918e4ae
Commit
d918e4ae
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
changes to support scons from peasoup-umbrella dir
parent
356757cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+2
-0
2 additions, 0 deletions
.gitignore
SConscript
+2
-1
2 additions, 1 deletion
SConscript
push64_relocs.cpp
+12
-21
12 additions, 21 deletions
push64_relocs.cpp
push64_relocs.h
+4
-3
4 additions, 3 deletions
push64_relocs.h
with
20 additions
and
25 deletions
.gitignore
+
2
−
0
View file @
d918e4ae
*.os
*.zpi
.sconsign.dblite
build
*.swp
...
...
This diff is collapsed.
Click to expand it.
SConscript
+
2
−
1
View file @
d918e4ae
...
...
@@ -65,4 +65,5 @@ Default( pedi )
ret
=
pedi
+
lib
Return
(
'
ret
'
)
This diff is collapsed.
Click to expand it.
push64_relocs.cpp
+
12
−
21
View file @
d918e4ae
...
...
@@ -57,11 +57,8 @@ bool Push64Relocs_t::IsRelocationWithType(Relocation_t *reloc,std::string type)
// would be nice to have a FindRelocation function that takes a parameterized type.
Relocation_t
*
Push64Relocs_t
::
FindRelocationWithType
(
Instruction_t
*
insn
,
std
::
string
type
)
{
Instruction_t
*
first_slow_path_insn
=
NULL
;
RelocationSet_t
::
iterator
rit
=
insn
->
getRelocations
().
begin
();
for
(
rit
;
rit
!=
insn
->
getRelocations
().
end
();
rit
++
)
for
(
auto
reloc
:
insn
->
getRelocations
())
{
Relocation_t
*
reloc
=*
rit
;
if
(
IsRelocationWithType
(
reloc
,
type
))
return
reloc
;
}
...
...
@@ -160,22 +157,19 @@ void Push64Relocs_t::HandlePush64Relocs()
int
push64_relocations_count
=
0
;
int
pcrel_relocations_count
=
0
;
// for each instruction
InstructionSet_t
::
iterator
iit
=
m_firp
.
getInstructions
().
begin
();
for
(
iit
;
iit
!=
m_firp
.
getInstructions
().
end
();
iit
++
)
for
(
auto
insn
:
m_firp
.
getInstructions
())
{
Instruction_t
*
insn
=*
iit
;
Relocation_t
*
reloc
=
NULL
;
auto
reloc
=
FindPushRelocation
(
insn
);
// caution, side effect in if statement.
if
(
reloc
=
FindPushRelocation
(
insn
)
)
if
(
reloc
)
{
if
(
*
m_verbose
)
cout
<<
"Found a Push relocation:"
<<
insn
->
getDisassembly
()
<<
endl
;
HandlePush64Relocation
(
insn
,
reloc
);
push64_relocations_count
++
;
}
// caution, side effect in if statement.
else
if
(
reloc
=
FindPcrelRelocation
(
insn
)
)
reloc
=
FindPcrelRelocation
(
insn
);
if
(
reloc
)
{
if
(
*
m_verbose
)
cout
<<
"Found a pcrel relocation."
<<
endl
;
...
...
@@ -197,13 +191,10 @@ void Push64Relocs_t::UpdatePush64Adds()
{
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
++
)
for
(
auto
insn
:
plopped_relocs
)
{
Relocation_t
*
reloc
=
NULL
;
Instruction_t
*
insn
=
*
insn_it
;
// caution, side effect in if statement.
if
(
reloc
=
FindPushRelocation
(
insn
))
auto
reloc
=
FindPushRelocation
(
insn
);
if
(
reloc
)
{
// would consider updating this if statement to be a function call for simplicity/readability.
bool
change_to_add
=
false
;
...
...
@@ -215,14 +206,14 @@ void Push64Relocs_t::UpdatePush64Adds()
Instruction_t
*
call
=
NULL
,
*
add
=
NULL
;
Relocation_t
*
add_reloc
=
NULL
;
call
=
*
insn
_it
;
call
=
insn
;
add
=
call
->
getTarget
();
assert
(
call
&&
add
);
call_addr
=
final_insn_locations
[
call
];
add_addr
=
final_insn_locations
[
add
];
Instruction_t
*
wrt_insn
=
dynamic_cast
<
Instruction_t
*>
(
reloc
->
getWRT
());
auto
wrt_insn
=
dynamic_cast
<
Instruction_t
*>
(
reloc
->
getWRT
());
if
(
wrt_insn
)
wrt_addr
=
final_insn_locations
[
wrt_insn
];
...
...
@@ -246,7 +237,7 @@ void Push64Relocs_t::UpdatePush64Adds()
// would this be simpler if we always used an add (or sub)
// and just signed the sign of the value we are adding (or subbing)?
if
(
add_offset
>
call_addr
)
if
(
(
size_t
)
add_offset
>
(
size_t
)
call_addr
)
{
change_to_add
=
true
;
if
(
wrt_insn
)
...
...
This diff is collapsed.
Click to expand it.
push64_relocs.h
+
4
−
3
View file @
d918e4ae
...
...
@@ -92,12 +92,13 @@ class Push64Relocs_t : public Zipr_SDK::ZiprPluginInterface_t
IRDB_SDK
::
Relocation_t
*
FindPushRelocation
(
IRDB_SDK
::
Instruction_t
*
insn
)
{
IRDB_SDK
::
Relocation_t
*
reloc
=
NULL
;
if
(
reloc
=
FindPush64Relocation
(
insn
)
)
auto
reloc
=
FindPush64Relocation
(
insn
)
;
if
(
reloc
)
{
return
reloc
;
}
if
(
reloc
=
Find32BitRelocation
(
insn
))
reloc
=
Find32BitRelocation
(
insn
);
if
(
reloc
)
{
return
reloc
;
}
...
...
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