[all-commits] [llvm/llvm-project] 208033: [flang-rt] Pass the whole path of libflang_rt.runt...

Daniel Chen via All-commits all-commits at lists.llvm.org
Thu Apr 3 08:21:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2080334574a88a7ac4102007b56809cd0a19b905
      https://github.com/llvm/llvm-project/commit/2080334574a88a7ac4102007b56809cd0a19b905
  Author: Daniel Chen <cdchen at ca.ibm.com>
  Date:   2025-04-03 (Thu, 03 Apr 2025)

  Changed paths:
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/AIX.cpp
    M clang/lib/Driver/ToolChains/AIX.h
    M clang/lib/Driver/ToolChains/AVR.cpp
    M clang/lib/Driver/ToolChains/AVR.h
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/lib/Driver/ToolChains/CommonArgs.h
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Driver/ToolChains/Darwin.h
    M clang/lib/Driver/ToolChains/DragonFly.cpp
    M clang/lib/Driver/ToolChains/FreeBSD.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/Haiku.cpp
    M clang/lib/Driver/ToolChains/MSVC.cpp
    M clang/lib/Driver/ToolChains/MinGW.cpp
    M clang/lib/Driver/ToolChains/MipsLinux.cpp
    M clang/lib/Driver/ToolChains/MipsLinux.h
    M clang/lib/Driver/ToolChains/NetBSD.cpp
    M clang/lib/Driver/ToolChains/OHOS.cpp
    M clang/lib/Driver/ToolChains/OHOS.h
    M clang/lib/Driver/ToolChains/OpenBSD.cpp
    M clang/lib/Driver/ToolChains/OpenBSD.h
    M clang/lib/Driver/ToolChains/PPCLinux.cpp
    M clang/lib/Driver/ToolChains/PPCLinux.h
    M clang/lib/Driver/ToolChains/Solaris.cpp
    A clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/powerpc64-ibm-aix/libflang_rt.runtime.a
    A clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/powerpc64le-unknown-linux-gnu/libflang_rt.runtime.a
    A clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/lib/powerpc64le-unknown-linux-gnu/libflang_rt.runtime.so
    M flang-rt/cmake/modules/GetToolchainDirs.cmake
    A flang/test/Driver/flang-ld-powerpc.f90

  Log Message:
  -----------
  [flang-rt] Pass the whole path of libflang_rt.runtime.a to linker on AIX and LoP (#131041)

This PR is to improve the driver code to build `flang-rt` path by
re-using the logic and code of `compiler-rt`.

1. Moved `addFortranRuntimeLibraryPath` and `addFortranRuntimeLibs` to
`ToolChain.h` and made them virtual so that they can be overridden if
customization is needed. The current implementation of those two
procedures is moved to `ToolChain.cpp` as the base implementation to
default to.

2. Both AIX and PPCLinux now override `addFortranRuntimeLibs`. 
The overriding function of `addFortranRuntimeLibs` for both AIX and
PPCLinux calls `getCompilerRTArgString` => `getCompilerRT` =>
`buildCompilerRTBasename` to get the path to `flang-rt`. This code
handles `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR` setting. As shown in
`PPCLinux.cpp`, `FT_static` is the default. If not found, it will search
and build for `FT_shared`. To differentiate `flang-rt` from `clang-rt`,
a boolean flag `IsFortran` is passed to the chain of functions in order
to reach `buildCompilerRTBasename`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list