[PATCH] D128333: [clang][flang] Disable defaulting to `-fpie` for LLVM Flang
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 27 15:02:24 PDT 2022
MaskRay added a comment.
In D128333#3613665 <https://reviews.llvm.org/D128333#3613665>, @awarzynski wrote:
> @MaskRay, thank for taking a look!
> In D128333#3605745 <https://reviews.llvm.org/D128333#3605745>, @MaskRay wrote:
>> gfortran defaults to PIE as well.
> While we strive to be compatible with `gfortan`, there's a lot relatively "basic" things still missing in LLVM Flang. So this is not the highest priority ATM.
>>> We can revisit this once support for -fpie and -fpic is available in LLVM Flang. I'm not aware of anyone actively working in this area.
>> Disagree. The PIE default should be fine. When PIE support is added, the default mode naturally becomes PIE.
>> Note: -fpie object files can be linked with either -no-pie or -pie. -fno-pic object files can only be linked with -no-pie.
>> -fpie is more portable than -fno-pic.
> But an object file with R_X86_64_32 relocations cannot be linked with a `-pie` object, right? How can I make sure that there are no such relocations then?
True. If it is difficult to override the `-pie` default from flang side, I am fine with the code change.
>> (Why does flang use clang/lib/Driver? For clang developers, it seems that `check-clang check-clang-tools` is not sufficient. `check-flang` needs to be used as well.)
> Otherwise, we'd have to re-implement clang/lib/Driver for LLVM Flang. This design was proposed and discussed here <https://lists.llvm.org/pipermail/cfe-dev/2019-June/062669.html>.
OK, so you did bring this up. I guess I'll have to accept...
>> For clang developers, it seems that `check-clang check-clang-tools` is not sufficient. `check-flang` needs to be used as well.)
> Isn't this a bit similar to e.g. LLVM developers? Or MLIR developers?
Comment at: flang/test/Driver/no-pie.f90:3
+! RUN COMMANDS
The `! RUN COMMANDS` and `EXPECTED OUTPUT` comments seem rather redundant. I'd remove them.
Comment at: flang/test/Driver/no-pie.f90:11
+! CHECK-NOT: fpie
+! CHECK-NOT: fpic
This NOT pattern can easily get stale. You need a test that driver `-pie` forwards `-pie` to the linker and by default `-pie` does not pass the the linker.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits