-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld-macho] Disable static assert failing on several platforms #107514
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
Conversation
@llvm/pr-subscribers-lld Author: None (alx32) ChangesRecently #106573 modified Disable the static assert it until we can find a universal solution. Full diff: https://github.com/llvm/llvm-project/pull/107514.diff 1 Files Affected:
diff --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp
index 9faf01e09de059..61becf97ba6728 100644
--- a/lld/MachO/Symbols.cpp
+++ b/lld/MachO/Symbols.cpp
@@ -18,12 +18,16 @@ using namespace lld::macho;
static_assert(sizeof(void *) != 8 || sizeof(Symbol) == 56,
"Try to minimize Symbol's size; we create many instances");
+// TODO: Fix this for all platforms or remove it.
+// https://github.com/llvm/llvm-project/issues/107511
+#if 0
// The Microsoft ABI doesn't support using parent class tail padding for child
// members, hence the _MSC_VER check.
#if !defined(_MSC_VER)
static_assert(sizeof(void *) != 8 || sizeof(Defined) == 88,
"Try to minimize Defined's size; we create many instances");
#endif
+#endif
static_assert(sizeof(SymbolUnion) == sizeof(Defined),
"Defined should be the largest Symbol kind");
|
@llvm/pr-subscribers-lld-macho Author: None (alx32) ChangesRecently #106573 modified Disable the static assert it until we can find a universal solution. Full diff: https://github.com/llvm/llvm-project/pull/107514.diff 1 Files Affected:
diff --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp
index 9faf01e09de059..61becf97ba6728 100644
--- a/lld/MachO/Symbols.cpp
+++ b/lld/MachO/Symbols.cpp
@@ -18,12 +18,16 @@ using namespace lld::macho;
static_assert(sizeof(void *) != 8 || sizeof(Symbol) == 56,
"Try to minimize Symbol's size; we create many instances");
+// TODO: Fix this for all platforms or remove it.
+// https://github.com/llvm/llvm-project/issues/107511
+#if 0
// The Microsoft ABI doesn't support using parent class tail padding for child
// members, hence the _MSC_VER check.
#if !defined(_MSC_VER)
static_assert(sizeof(void *) != 8 || sizeof(Defined) == 88,
"Try to minimize Defined's size; we create many instances");
#endif
+#endif
static_assert(sizeof(SymbolUnion) == sizeof(Defined),
"Defined should be the largest Symbol kind");
|
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.
LGTM, this would fix the build for mingw targets.
I think the issue is that Windows targets only "merge" bit fields when the underlying types have the same size. Can someone check that this fixes the issue? diff --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h
index 70fd195f25c9..bfb777b86621 100644
--- a/lld/MachO/Symbols.h
+++ b/lld/MachO/Symbols.h
@@ -14,6 +14,7 @@
#include "Target.h"
#include "llvm/Object/Archive.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
namespace lld {
@@ -152,7 +153,8 @@ public:
// Whether this symbol should appear in the output symbol table.
bool includeInSymtab : 1;
// The ICF folding kind of this symbol: None / Body / Thunk.
- ICFFoldKind identicalCodeFoldingKind : 2;
+ LLVM_PREFERRED_TYPE(ICFFoldKind)
+ uint8_t identicalCodeFoldingKind : 2;
// Symbols marked referencedDynamically won't be removed from the output's
// symbol table by tools like strip. In theory, this could be set on arbitrary
// symbols in input object files. In practice, it's used solely for the |
Yes, this does seem to fix the issue for me, too. Thanks! |
Alternative fix: #107545 |
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.
With the alternative fix merged already, this PR shouldn't be necessary any longer.
Recently #106573 modified
Define
and caused the size to change on some platforms.Issue: #107511
Disable the static assert it until we can find a universal solution.