-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[lldb][test] Disable PIE for some API tests #93808
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-lldb Author: Vladislav Dzhidzhoev (dzhidzhoev) ChangesWhen PIE is enabled on a platform by default, these tests fail since the Full diff: https://github.com/llvm/llvm-project/pull/93808.diff 3 Files Affected:
diff --git a/lldb/test/API/commands/target/basic/Makefile b/lldb/test/API/commands/target/basic/Makefile
index b31e594019f6f..e66971834b689 100644
--- a/lldb/test/API/commands/target/basic/Makefile
+++ b/lldb/test/API/commands/target/basic/Makefile
@@ -3,4 +3,8 @@
# C_SOURCES := b.c
# EXE := b.out
+ifndef PIE
+ LDFLAGS := -no-pie
+endif
+
include Makefile.rules
diff --git a/lldb/test/API/lang/c/global_variables/Makefile b/lldb/test/API/lang/c/global_variables/Makefile
index 7b94b6556f254..00c2557033d81 100644
--- a/lldb/test/API/lang/c/global_variables/Makefile
+++ b/lldb/test/API/lang/c/global_variables/Makefile
@@ -2,5 +2,8 @@ C_SOURCES := main.c
DYLIB_NAME := a
DYLIB_C_SOURCES := a.c
+ifndef PIE
+ LDFLAGS := -no-pie
+endif
include Makefile.rules
diff --git a/lldb/test/API/lang/cpp/char8_t/Makefile b/lldb/test/API/lang/cpp/char8_t/Makefile
index e7c9938b5a85e..28f982a0078d8 100644
--- a/lldb/test/API/lang/cpp/char8_t/Makefile
+++ b/lldb/test/API/lang/cpp/char8_t/Makefile
@@ -1,4 +1,7 @@
CXX_SOURCES := main.cpp
CXXFLAGS_EXTRAS := -std=c++2a -fchar8_t
+ifndef PIE
+ LDFLAGS := -no-pie
+endif
include Makefile.rules
|
What do the failures look like? I tried to force -pie on some of the tests that you modified, and I couldn't get them to fail. Is this somehow specific to remote execution? |
No, it seems not to be related to the remote test execution.
cmake command line looks like this:
For example, TestTargetCommand.py fails with the error:
This test fails when it tries to evaluate the global variable my_global_str of char* type before running the executable. LLDB can't decode its value before dynamic relocations are resolved in the binary. These relocations show up when PIE is enabled. And, for clang, it seems to be enabled by default on linux aarch64. |
Ok, I see now. It's an ld.bfd vs ld.lld thing. You probably have your clang configured to use lld. LLD does not put relocation addends into the data section (on both arm and intel). ld.bfd does, which is why this sort of happens to work there. Was your intention to test with LLD? |
Yep, I run it with lld built together with clang and lldb. Should the condition be narrowed to affect only builds with lld? |
No, I think this is fine. I don't believe we have the ability to detect the linker used at the moment, and I'd like to avoid adding new dimensions to the test suite. Plus, the It's possible this could break some targets (like android) that do not support building/running non-PIE executables, but if that happens, we should just get those targets to set the PIE flag. |
@@ -3,4 +3,8 @@ | |||
# C_SOURCES := b.c | |||
# EXE := b.out | |||
|
|||
ifndef PIE | |||
LDFLAGS := -no-pie |
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.
Setting LD_EXTRAS is the typical way to pass linker flags from here (the same for other files)
These tests fail when PIE is enabled by default on a platform since `target variable` can't read global string variable value before running inferior.
d305048
to
eaf50dc
Compare
hi @dzhidzhoev, I think this commit is causing the arm lldb incremental bots to fail. |
@dzhidzhoev I think @labath 's suggestion might fix this (LD_EXTRAS) |
This is a fixup to #93808, which used LDFLAGS instead of the correct LD_EXTRAS
Pushed a fix |
Thanks. |
When PIE is enabled on a platform by default, these tests fail since the
target variable
command can't read a global string variable value before running an inferior process.It fixes the following tests when built with clang on Ubuntu aarch64: