[PATCH] D134821: [flang][driver] Allow main program to be in an archive

Emil Kieri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 12:16:51 PDT 2022


ekieri created this revision.
ekieri added reviewers: awarzynski, peixin, sscalpone.
Herald added projects: Flang, All.
ekieri requested review of this revision.
Herald added subscribers: cfe-commits, jdoerfert, MaskRay.
Herald added a project: clang.

Add --undefined=_QQmain to the link line, so that a Fortran main program
will be included in the link job even if it is in an archive (unless we
are building a shared object). For now, this is only applied to the Gnu
toolchain.

We also add a section on the linker invocation to docs/FlangDriver.md.

The new tests require llvm-ar to construct an archive we can include in
the link job. This is a new dependency for flang/test (which already
depends on similar tools such as llvm-objdump).

See discussions in
https://github.com/llvm/llvm-project/issues/54787
which this patch fixes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134821

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp
  flang/docs/FlangDriver.md
  flang/test/CMakeLists.txt
  flang/test/Driver/link-c-main.c
  flang/test/Driver/link-f90-main.f90
  flang/test/Driver/linker-flags.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134821.463646.patch
Type: text/x-patch
Size: 6988 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220928/8ff56878/attachment-0001.bin>


More information about the cfe-commits mailing list