-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[FreeBSD] Fix a few issues #12528
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
[FreeBSD] Fix a few issues #12528
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
#include <link.h> | ||
#include <string.h> | ||
|
||
#if defined(__ANDROID__) | ||
#if defined(__ANDROID__) || defined(__FreeBSD__) | ||
#include "llvm/ADT/StringRef.h" | ||
#endif | ||
|
||
|
@@ -72,9 +72,14 @@ static SectionInfo getSectionInfo(const char *imageName, | |
SectionInfo sectionInfo = { 0, nullptr }; | ||
void *handle = dlopen(imageName, RTLD_LAZY | RTLD_NOLOAD); | ||
if (!handle) { | ||
#ifdef __ANDROID__ | ||
#if defined(__ANDROID__) || defined(__FreeBSD__) | ||
#if defined(__ANDROID__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not extremely happy about this macro dance but it seems consistent with what's there (and probably OK). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this necessary on FreeBSD? It is necessary on Android because the OS hides the contents of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about the reasons but this part is called and fails with |
||
const char *systemPath = "/system/lib"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any chance you could change this to “/system” while you’re in the neighbourhood as there are libraries that are blocked in “/system/vendor” as well as “/system/lib" on some devices. None of these libraries will have Swift implementations to worry about conformance for. Saves us all a PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :-/ Let's not mix FreeBSD and Android changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :-/ |
||
#elif defined(__FreeBSD__) | ||
const char *systemPath = "/libexec"; | ||
#endif | ||
llvm::StringRef imagePath = llvm::StringRef(imageName); | ||
if (imagePath.startswith("/system/lib") || | ||
if (imagePath.startswith(systemPath) || | ||
(imageName && !imagePath.endswith(".so"))) { | ||
return sectionInfo; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a very specific path to hardcode, but I'll take your word for it that it's a reasonable. (Especially for a CMake section we'd like to clean up later.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hard-coded path does not work on my build. The
.a
file has been moved tobuild/Ninja-ReleaseAssert/llvm-freebsd-x86_64/lib/clang/5.0.0/lib/freebsd/libclang_rt.builtins-${arch}.a
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah,
${SWIFTLIB_DIR}/clang
should be a symlink tolib/clang/5.0.0
, so if you're seeing issues here, something else has gone wrong.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if you haven't built in a long time, the Clang version of the symlink may not match the actual Clang version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I checked and the symlink is there and correct. I wonder why
cmake
doesn't follow it...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I commented out these lines and swift built just fine. So it might be the case that they can be removed in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible you just weren't using anything (from C) that needed atomics.