[all-commits] [llvm/llvm-project] b40540: [clang][flang] Disable defaulting to `-fpie` for L...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Wed Jun 29 00:54:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b405407a489902c0acfcf936bfda9821a1deb170
      https://github.com/llvm/llvm-project/commit/b405407a489902c0acfcf936bfda9821a1deb170
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/Linux.cpp
    M flang/docs/ReleaseNotes.md
    A flang/test/Driver/pic-flags.f90

  Log Message:
  -----------
  [clang][flang] Disable defaulting to `-fpie` for LLVM Flang

In, https://reviews.llvm.org/D120305, CLANG_DEFAULT_PIE_ON_LINUX was set
to `On` by default. However, neither `-fpie` nor `-fpic` are currently
supported in LLVM Flang. Hence, in this patch the behaviour controlled
with CLANG_DEFAULT_PIE_ON_LINUX is refined not to apply to Flang.

Another way to look at this is that CLANG_DEFAULT_PIE_ON_LINUX is
currently affecting both Clang and Flang. IIUC, the intention for this
CMake variable has always been to only affect Clang. This patch makes
sure that that's the case.

Without this change, you might see errors like this on X86_64:
```
/usr/bin/ld: main.o: relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
```
I've not experienced any issues on AArch64. That's probably because on
AArch64 some object files happen to be position independent without
needing -fpie or -fpic.

Differential Revision: https://reviews.llvm.org/D128333




More information about the All-commits mailing list