-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-13165] Is splitting ImageInspectionELF.cpp into swiftImageInspectionShared necessary? #55608
Comments
Comment by 3405691582 (JIRA) cc @spevans |
The reason for the split into When building with When building a fully static executable using So because there are 2 different implementations of Note that |
Note Example: $ cat dladdr-test.c
#include <stdio.h>
#define __USE_GNU 1
#include <dlfcn.h>
int main() {
Dl_info info = {};
if (dladdr(main, &info)) {
printf("fname:\t%s\n", info.dli_fname);
printf("base:\t%p\n", info.dli_fbase);
printf("sname:\t%s\ns", info.dli_sname);
printf("saddr:\t%p\n", info.dli_saddr);
} else {
puts("Cant dladdr() main");
}
return 0;
} # Ubuntu 18.04
$ clang -Wall -o dynamic-dladdr dladdr-test.c -ldl
$ ./dynamic-dladdr
fname: ./dynamic-dladdr
base: 0x400000
sname: (null)
ssaddr: (nil)
$ clang -Wall -static -o static-dladdr dladdr-test.c -ldl
$ ./static-dladdr
Cant dladdr() main # OpenBSD 6.6
$ clang -Wall -o dynamic-dladdr dladdr-test.c
$ ./dynamic-dladdr
fname: ./dynamic-dladdr
base: 0x160e3000
sname: (null)
ssaddr: 0x0
$ clang -Wall -static -o static-dladdr dladdr-test.c
$ ./static-dladdr
Wrong dl symbols!
fname: (null)
base: 0x0
sname: (null)
ssaddr: 0x0 |
There is a new version of my PR @ #34180 that removes the split at the cost of |
The split has been removed now and there is no separate |
Comment by 3405691582 (JIRA) Thank you! |
Additional Detail from JIRA
md5: 690e563998a653a367ea95c34a707ee2
Issue Description:
stdlib/public/runtime/CMakeLists.txt
splitsImageInspectionELF.cpp
out fromswift_runtime_sources
into its own library,swiftImageInspectionShared
. There appear to still be references fromErrors.cpp
inswift_runtime_sources
tolookupSymbol
inImageInspectionELF.cpp
, which means whenSWIFT_BUILD_STATIC_STDLIB
, ifswiftImageInspectionShared
is not referred to, complaints about undefined symbols when lazy binding will occur.This additional error output fouls up the expectation in a number of unit tests, see pr #32736. This only occurs when
SWIFT_BUILD_STATIC_STDLIB
. (Specifically, the reference inErrors.cpp
is only whenSWIFT_SUPPORTS_BACKTRACE_REPORTING
too.)Is making this split truly necessary? I suspect it may not be, but I'd have to do some testing on Linux machines to see what the effect would be. See pr #5394, SR-648.
The text was updated successfully, but these errors were encountered: