[all-commits] [llvm/llvm-project] 17feb3: [flang][Driver] Let the linker fail on multiple de...

Michael Klemm via All-commits all-commits at lists.llvm.org
Tue Nov 28 12:20:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17feb330aab39c6c0c21ee9b02efb484dfb2261e
      https://github.com/llvm/llvm-project/commit/17feb330aab39c6c0c21ee9b02efb484dfb2261e
  Author: Michael Klemm <michael.klemm at amd.com>
  Date:   2023-11-28 (Tue, 28 Nov 2023)

  Changed paths:
    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/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/NetBSD.cpp
    M clang/lib/Driver/ToolChains/OpenBSD.cpp
    M clang/lib/Driver/ToolChains/Solaris.cpp
    A flang/test/Driver/Inputs/no_duplicate_main.ll
    M flang/test/Driver/linker-flags.f90
    A flang/test/Driver/no_duplicate_main.f90

  Log Message:
  -----------
  [flang][Driver] Let the linker fail on multiple definitions of main() (#73124)

The flang driver was silently ignoring the `main()` function in
`Fortran_main.a` for entry into the Fortran program unit if an external
`main()` as supplied (e.g., via cross-language linkage with Fortran and
C/C++). This PR fixes this by making sure that the linker always pulls
in the `main()` definition from `Fortran_main.a` and consequently fails
due to multiple definitions of the same symbol if another object file
also has a definition of `main()`.




More information about the All-commits mailing list