[PATCH] D131533: [Flang][Driver] Enable PIC in the frontend

Valentin Clement via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 11:13:31 PDT 2023


clementval added inline comments.


================
Comment at: flang/test/Driver/pic-flags.f90:3
 
-! RUN: %flang -### %s --target=aarch64-linux-gnu 2>&1 | FileCheck %s --check-prefix=CHECK-NOPIE
-! RUN: %flang -### %s --target=aarch64-linux-gnu -fno-pie 2>&1 | FileCheck %s --check-prefix=CHECK-NOPIE
+! RUN: %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: %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
----------------
awarzynski wrote:
> clementval wrote:
> > This test has been failing on my side for very long time. Just curious why we check for PIE-LEVEL-2 when no level is given. Where is the default given?
> > 
> > On my machine I have `-mrelocation-model static` for this run line. 
> > This test has been failing on my side for very long time. 
> 
> If this is failing for you then it should also fail on one of the Flang buildbots, right? Do you know what's different/special in your configuration?
> 
> > Where is the default given?
> 
> You want to check:
> * [[ https://github.com/llvm/llvm-project/blob/2712b2805b47f10b3864ab19a4016ea306126ad7/clang/lib/Driver/ToolChains/Flang.cpp#L149-L168 | Flang::addPicOption ]] (Flang.cpp)
> * [[ https://github.com/llvm/llvm-project/blob/2712b2805b47f10b3864ab19a4016ea306126ad7/clang/lib/Driver/ToolChains/CommonArgs.cpp#L1399 | ParsePICArgs ]] (CommonArgs.cpp)
>If this is failing for you then it should also fail on one of the Flang buildbots, right? Do you know what's different/special in your configuration?

Well I probably have a config that is not in any buildbot. 

In my configuration the PICLevel is 0 for `flang-new -v -S -emit-llvm -o - /local/home/vclement/llvm-project/flang/test/Driver/pic-flags.f90 --target=aarch64-linux-gnu 2>&1`

Which makes sense since no pic option is given. I'm wondering how it default to 2 on buildbot. I'll try to investigate. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131533/new/

https://reviews.llvm.org/D131533



More information about the cfe-commits mailing list