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

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 13:09:21 PDT 2023


awarzynski added a comment.

Thanks for all the great effort, @ekieri !

@sunshaoce , mostly makes sense, just a few small suggestions. @peixin , wdyt?



================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:601-603
+    // A Fortran main program will be lowered to a function named _QQmain. Make
+    // _QQmain an undefined symbol, so that we include it even if it hides
+    // inside an archive.
----------------
WDYT>


================
Comment at: flang/test/Driver/link-c-main.c:3
+Test that an object file with a c main function can be linked to an executable
+by flang.
+
----------------



================
Comment at: flang/test/Driver/link-c-main.c:5
+
+For now, this test only covers the Gnu toolchain on linux.
+
----------------



================
Comment at: flang/test/Driver/linker-flags.f90:15
 
+! Check linker invocation to generate shared object (only GNU toolchain for now)
+! RUN: %flang -### -flang-experimental-exec -shared -target x86_64-linux-gnu %S/Inputs/hello.f90 2>&1 | FileCheck %s --check-prefixes=CHECK,GNU-SHARD --implicit-check-not _QQmain
----------------
Please, could you clarify that in this case `_QQmain` should not be flagged as undefined?


================
Comment at: flang/test/Driver/linker-flags.f90:61
+! Linker invocation to generate a shared object
+! GNU-SHARD-LABEL:  "{{.*}}ld"
+! GNU-SHARD-SAME: "[[object_file]]"
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134821



More information about the cfe-commits mailing list