-
-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbols are being double counted. #962
Comments
Okay I found the delta but I think it's still a bug. Looks like shndx is the same for both but not the section property. |
Actually you have two symbol tables in your binaries: So yes, you can observe twice the same symbol because of these two tables. You can use |
ok that makes sense. @romainthomas but both symbols have
One of them should be |
Adding more debugging. Here is the output stripped from
I can see both have the binding LIEF/include/LIEF/ELF/Symbol.hpp Line 151 in 1f52f26
is_static being True .
|
There is no symbol attributes to distinguish |
is_static refers to the |
h = elf.get_dynamic_symbol("h")
print(h.section)
h = elf.get_static_symbol("h")
print(h.section) both are set |
@romainthomas can we keep this open? There is some bug I believe. Here you can see that if I get the symbols via
The comment may need to change to just reflect binding? For instance, I am debugging a file with no I will use the property access method itself to distinguish them as well. Edit: Edit2: Thank you for your responses. |
Indeed I'll fix it.
I think you are not using the version with the previous fix (8ef47cd) import lief
binary = lief.parse("./x/libx.so")
foo_syms = list(filter(lambda sym: sym.name == "h", binary.symbols))
print(foo_syms[0].section.name)
Make sure to understand the difference between |
As a response to lief-project/LIEF#962 only iterate static or dynamic symbols. Added a simple Makefile to demonstrate shadowing variables.
As a response to lief-project/LIEF#962 only iterate static or dynamic symbols. Added a simple Makefile to demonstrate shadowing variables.
As a response to lief-project/LIEF#962 only iterate static or dynamic symbols. Added a simple Makefile to demonstrate shadowing variables.
Describe the bug
Here is a sample Makefile:
When I try to load one of the shared objects (
libx2.so
) this into lief it is double counting the symbols and I'm not sure why.You can see here that I'm using
inspect.getmembers
to try and find the difference between them but they look identical.Here is the output of
nm
:To Reproduce
Run the makefile provided and inspect.
Expected behavior
There should only be a single
h
Environment (please complete the following information):
python -c "import lief;print(lief.__version__)"
or the one fromLIEF/config.h
The text was updated successfully, but these errors were encountered: