-
Notifications
You must be signed in to change notification settings - Fork 46
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
llvm-addr2line
does not work on AOMP-generated binary
#616
Comments
I confirm this fails in 18.0-0 .
I am not familiar with llvm-addr2line nor dladdr. I will ask around. |
AOMP is producing a true executable, rather than a shared object or PIE:
Of note, it seems like Either way, the addresses in the DWARF information for an EXEC ELF are already virtual addresses (see section 7.3.3 "Executable Objects") so subtracting out the load address is incorrect. You can reproduce the issue without any LLVM/AMD tooling at all, e.g. with
If there is any bug to file against AOMP it would just be that it likely should not produce a non-PIE executable. I don't know enough context about that default to comment more though. |
Apologies for the radio-silence. I just re-tested everything with the latest versions of AOMP and upstream LLVM, both of which behave the same.
(Without Interestingly, when an opt-level > 0 is used we will get the following warning -AND- another line number (the one of the return statement) with AOMP and LLVM upstream (gcc remains the same, at the function definition): Since this behavior is not AOMP exclusive, I guess this should be tackled upstream. From the history of this ticket we should expect to compile the given example into a I will also take a look (i.e. at least try(!) to understand) why the opt-level changes the reported line number. |
The form it is confused by is DW_FORM_loclistx which is new to DWARF5. It likely only shows up when optimizing because the location at O0 is generally just a single stack location for the life of the variable, so non-loclist form works for everything. The |
Thanks for all the info, much appreciated! Using |
tl;dr: My take is this: the issue seems resolved. (If there are no objections, I will close the issue in one week.) So, I did quite a bit of testing with different versions of AOMP and upstream LLVM. IMHO this basically invalidates the original reason the ticket was submitted. However, we should take note that I observed the following differences between
|
Closing as discussed. |
Considering the following minimal example:
foo.c
:run.sh
:With LLVM-upstream clang 17.0.0, it works as expected and prints the source location of
bar
:However, with AOMP, the source attribution fails, as
dladdr
seems to return a wrong address:AOMP clang version:
AOMP_STANDALONE_17.0-3 clang version 17.0.0 (https://github.com/radeonopencompute/llvm-project f959ea5d8d1e5aef4b6d06727a9698316d3d33cd)
The text was updated successfully, but these errors were encountered: