[PATCH] D128333: [clang][flang] Disable defaulting to `-fpie` for LLVM Flang

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 27 14:48:49 PDT 2022


awarzynski added a comment.

@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?

> (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>.

> 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?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128333



More information about the cfe-commits mailing list