-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[flang][Driver] Guard check for pic/pie settings without driver flags #143530
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
The default relocation model for aarch64 seems to be "static", but the pic-flags.f90 test was expecting both pic and pie settings.
@llvm/pr-subscribers-flang-driver Author: Krzysztof Parzyszek (kparzysz) ChangesThe default relocation model for aarch64 seems to be "static", but the pic-flags.f90 test was expecting both pic and pie settings. Full diff: https://github.com/llvm/llvm-project/pull/143530.diff 1 Files Affected:
diff --git a/flang/test/Driver/pic-flags.f90 b/flang/test/Driver/pic-flags.f90
index cb62d353cc18c..d63a69c913fa1 100644
--- a/flang/test/Driver/pic-flags.f90
+++ b/flang/test/Driver/pic-flags.f90
@@ -1,6 +1,5 @@
! RUN: %if aarch64-registered-target %{ %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fno-pie 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-STATIC,CHECK-STATIC-IR %}
-! RUN: %if aarch64-registered-target %{ %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL2,CHECK-PIE-LEVEL2-IR %}
! RUN: %if aarch64-registered-target %{ %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fpie 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL1,CHECK-PIE-LEVEL1-IR %}
! RUN: %if aarch64-registered-target %{ %flang -v -S -emit-llvm -o - %s --target=aarch64-linux-gnu -fPIE 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-PIE-LEVEL2,CHECK-PIE-LEVEL2-IR %}
|
This test always fails with my local build. I have all targets enabled (with x86_64 being the default one), but maybe it needs some specific build flags for the default behavior to be as expected by the test. It's only the part that checks for PIC/PIE without specifying any command-line options that fails, the invocations that specify PIC/PIE work fine. |
Does not fail on us. Maybe because we use |
I think LLVM_ENABLE_PIC controls whether PIC is used to compile LLVM itself. Here are my cmake flags: Maybe it's the CLANG_DEFAULT_PIE_ON_LINUX=OFF? In any case, a check like that in a testcase should probably be guarded by something. |
No idea, could be, we're not setting it. |
I removed the CLANG_DEFAULT_PIE_ON_LINUX=OFF flag, and the test now passes. I still think it should be removed because it depends on build options, and can fail even when everything works as intended. |
Let Andrzej (@banach-space) decide, he created this file. |
Hey @kparzysz , thanks for digging into this!
How about adding an extra condition to that
? |
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, thanks!
[nit] Could you document somewhere (commit summary?) what makes clang_default_pie_on_linux
necessary in this particular case?
…llvm#143530) The default relocation model for clang depends on the cmake flag CLANG_DEFAULT_PIE_ON_LINUX. By default it is set to ON, but when it's OFF, the default relocation model will be "static". The outcome of the test running clang without any PIC/PIE flags will depend on the cmake flag, so make sure it only runs when the flag is ON.
…llvm#143530) The default relocation model for clang depends on the cmake flag CLANG_DEFAULT_PIE_ON_LINUX. By default it is set to ON, but when it's OFF, the default relocation model will be "static". The outcome of the test running clang without any PIC/PIE flags will depend on the cmake flag, so make sure it only runs when the flag is ON.
The default relocation model for clang depends on the cmake flag CLANG_DEFAULT_PIE_ON_LINUX. By default it is set to ON, but when it's OFF, the default relocation model will be "static".
The outcome of the test running clang without any PIC/PIE flags will depend on the cmake flag, so make sure it only runs when the flag is ON.