-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only iterate static or dynamic symbols (#9)
As a response to lief-project/LIEF#962 only iterate static or dynamic symbols. Added a simple Makefile to demonstrate shadowing variables.
- Loading branch information
Showing
5 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ sqlelf.egg-info/ | |
.vscode/ | ||
dist/ | ||
result | ||
examples/shadowed-symbols/exe | ||
examples/**/*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
all: exe | ||
|
||
# This library depends libx2.so soname and calls h() from it | ||
y/liby.so: x/libx2.so | ||
@mkdir -p $(dir $@) | ||
echo 'extern int foo(); int g() { return foo(); }' | $(CC) -o $@ -shared -x c - -Lx -l:libx2.so '-Wl,--no-as-needed,--enable-new-dtags,-rpath,$$ORIGIN/../x' | ||
|
||
# This library has both file and soname libx.so | ||
x/libx.so: | ||
@mkdir -p $(dir $@) | ||
echo 'int foo(){return 12;}' | $(CC) -o $@ -shared -x c - | ||
|
||
# This library has both file and soname libx.so | ||
x/libx2.so: | ||
@mkdir -p $(dir $@) | ||
echo 'int foo(){return 1000;}' | $(CC) -o $@ -shared -x c - | ||
|
||
# This links to b/liby.so and c/libx.so, and gets libx.so and liby.so in DT_NEEDED, no paths. | ||
exe: y/liby.so x/libx.so | ||
echo 'extern int g(); extern int foo(); int main(){ printf("\%d\n", g() + foo()); }' | \ | ||
$(CC) -o $@ -include stdio.h -x c - -Ly -Lx -l:liby.so '-Wl,--no-as-needed,--enable-new-dtags,-rpath,$$ORIGIN/y' \ | ||
-l:libx.so '-Wl,--no-as-needed,--enable-new-dtags,-rpath,$$ORIGIN/x' | ||
|
||
clean: | ||
rm -rf -- x y exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters