mjklemm wrote:
@DavidTruby If you are OK with the way I handled MSVC, please approve and I
will merge the PR (or change it if you want some changes to be made).
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@l
mjklemm wrote:
> Chipping into the discussion, since this patch I can also no longer build
> OpenBLAS or PETSc. OpenBLAS for example fails with
>
> ```
> $ clang -v -O3 -mcpu=native -DHAVE_C11 -Wall -DF_INTERFACE_GFORT -fPIC
> -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=72 -DMAX_PARALLEL_NUMBER
mjklemm wrote:
Thanks for the reproducer.
> The error shows up when linking a C program with a Fortran shared library, so
> maybe you weren't enabling building shared libraries?
I was building OpenBLAS using the "old" Makefile-based build. There the issue
indeed does not happen. When I swit
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/7] Add -fno-fortran-main driver option
---
clang/include/clang/
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/8] Add -fno-fortran-main driver option
---
clang/include/clang/
@@ -6345,6 +6345,10 @@ def J : JoinedOrSeparate<["-"], "J">,
Group,
Alias;
+def no_fortran_main : Flag<["-"], "fno-fortran-main">,
+ Visibility<[FlangOption]>, Group,
+ HelpText<"Don't link in Fortran main">;
+
mjklemm wrote:
@banach-space
```
let Vis
mjklemm wrote:
> I know that it's extra work, but it's also super useful bit of documentation.
> And I would only rarely try to track the history beyond commit messages
> (there's just too much otherwise).
I can absolutely do that. I'll craft some wording for the rationale behind
that change
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
mjklemm wrote:
I have a Windows test machine. How can I help?
https://github.com/llvm/llvm-project/pull/74377
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/9] Add -fno-fortran-main driver option
---
clang/include/clang/
@@ -6345,6 +6345,10 @@ def J : JoinedOrSeparate<["-"], "J">,
Group,
Alias;
+def no_fortran_main : Flag<["-"], "fno-fortran-main">,
+ Visibility<[FlangOption]>, Group,
+ HelpText<"Don't link in Fortran main">;
mjklemm wrote:
Done, with a slightly differe
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From e0784bd3a6103fe6852ecc67fb01a4a8da1cf59a Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/9] Add -fno-fortran-main driver option
---
clang/include/clang/
https://github.com/mjklemm closed
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
mjklemm wrote:
@tblah @rj-jesus https://github.com/llvm/llvm-project/pull/74139 has landed.
Can you please see if `-fno-fortran-main` helps to resolve your bugs? I will
write up a blog article about this and publish it. Maybe it would be worth
documenting this as a question on StackOverflow
https://github.com/mjklemm created
https://github.com/llvm/llvm-project/pull/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
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From ba38aec7ac04c63fd5167908fe7f91d6ac7bceed Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 1/2] Let the linker fail on multiple definitions of main()
---
c
@@ -1029,7 +1042,7 @@ void tools::addFortranRuntimeLibraryPath(const ToolChain
&TC,
ArgStringList &CmdArgs) {
// Default to the /../lib directory. This works fine on the
// platforms that we have tested so far. We will probably have
mjklemm wrote:
> Would it be possible to test this?
Sure thing! That's the next thing I can look at. I'd like to probe though if
the general solution is acceptable.
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing list
cfe-co
mjklemm wrote:
> We are also seeing the same issue when linking on Mac regarding the ld:
> unknown options: --whole-archive
Is there an equivalent option for the MacOS linker?
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing li
mjklemm wrote:
> > LGTM. Worked fine on my machine.
>
> >
>
> > NOTE: tested by replacing `CommonArgs.cpp` in main, to avoid conflicts.
>
>
>
> Thanks for checking and apologies for the merge conflict - I thought that I
> was up to date :( I've just rebased and force-pushed.
>
>
>
> I
mjklemm wrote:
Let's get this in. I agree with the assessment by @banach-space. The PR looks
good to me.
https://github.com/llvm/llvm-project/pull/75393
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/75534
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mjklemm approved this pull request.
LGTM!
Thanks for the refactoring. This makes the code much easier to digest!
https://github.com/llvm/llvm-project/pull/75534
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
@@ -1116,73 +1116,87 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
+/// Determines if --whole-archive is active in the list of arguments.
+static bool isWholeArchivePresent(const ArgList &Args) {
+ bool WholeArchiveActive = fal
@@ -1116,73 +1116,87 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
+/// Determines if --whole-archive is active in the list of arguments.
+static bool isWholeArchivePresent(const ArgList &Args) {
+ bool WholeArchiveActive = fal
https://github.com/mjklemm approved this pull request.
Looks good to me. Did touch testing with my reproducers and it worked as I
would expect it.
https://github.com/llvm/llvm-project/pull/75648
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/mjklemm created
https://github.com/llvm/llvm-project/pull/75816
At present, when building static or shared libraries, Flang adds
`-lFortran_main.a` (or `/WHOLEARCHIVE:Fortran.*.lib` pon Windows) to the link
line. This leads to the problem that `_QQmain` and `_QQEnvironmentD
mjklemm wrote:
> Thanks! Mostly looks good, but I have a question:
>
> > This leads to the problem that _QQmain and _QQEnvironmentDefaults (as of
> > the time of this PR) are symbols marked as used, while main is being
> > defined.
>
> Sorry for being pedantic, but not sure I follow. `Fortran
mjklemm wrote:
> > Also, not sure what defines `_QQEnvironmentDefaults ` and what exactly
> > makes it problematic?
>
> The `main` entrypoint also calls `_QQEnvironmentDefaults` to treat `argc`,
> `argv`, etc. So, when `main` is included in the shared object, so will be
> those symbols are us
mjklemm wrote:
> I see. So Fortran and C interoperability of F2003/F2008 is not supported yet
> in Flang?
It's rather untested and I'm working hard to get it fixed, so that we have
well-defined behavior that is similar to other Fortran compilers like ifx and
gfortran.
> Those ~100ish regres
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/75816
>From 511f3a4537267284554bf6b33470a01d747b8a94 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Sat, 16 Dec 2023 20:15:17 +0100
Subject: [PATCH 1/3] Remove -lFortran_main from the link line when -shared is
pre
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/75816
>From 511f3a4537267284554bf6b33470a01d747b8a94 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Sat, 16 Dec 2023 20:15:17 +0100
Subject: [PATCH 1/4] Remove -lFortran_main from the link line when -shared is
pre
mjklemm wrote:
> I would probably create a section on building executables and just mention
> that 3 runtime libs will be linked auto-magically. Unless somebody uses
> `-fno-fortran-main` ;-) Make it as short or as long as you prefer - your
> contribution is greatly appreciated ππ» :)
If have
mjklemm wrote:
> May be I missed it when reading through the comments of this PR, why there is
> a definition of `main()` being generated on the Fortran side when the Fortran
> sources are procedures or modules?
It was always generated before, but the bug was hidden by the linker doing the
ri
mjklemm wrote:
@banach-space How did you draw the pictures in the MD file that I'm changing?
If you have some sort of source file, I can try to add a nice chart to the
explanation, I'm adding.
https://github.com/llvm/llvm-project/pull/75816
___
cfe-
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From ba38aec7ac04c63fd5167908fe7f91d6ac7bceed Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 1/5] Let the linker fail on multiple definitions of main()
---
c
@@ -122,6 +122,7 @@
# the build directory holding that tool.
tools = [
ToolSubst("%flang", command=FindTool("flang-new"), unresolved="fatal"),
+ToolSubst("%clang", command=FindTool("clang"), unresolved="fatal"),
mjklemm wrote:
@banach-space I had to ad
mjklemm wrote:
> Would it be possible to test this?
I have added a simple test. It checks that the linker indeed fails, but does
not check the actual linker error message. PLease let me know if that's
desired. I could then provide the error messages for LD and LLD. For other
environments,
@@ -0,0 +1,13 @@
+! RUN: %clang -x c -o %t.c-part -c %s.c-part
mjklemm wrote:
That does not seem to work and gives me this error when running the test.
`error: unknown integrated tool '-cc1'. Valid tools include '-fc1'.`
I do not necessarily need `clang` as the
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From ba38aec7ac04c63fd5167908fe7f91d6ac7bceed Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 1/6] Let the linker fail on multiple definitions of main()
---
c
mjklemm wrote:
Done.
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,15 @@
+! UNSUPPORTED: system-windows
+
+! RUN: %clang -o %t.c-object -c %S/Inputs/main_dupes.c
mjklemm wrote:
When I do this, the test goes to "unsupported" for me, as it seems that %cc is
not set as a substitution in lit.cfg.py.
https://github.com/l
@@ -0,0 +1,13 @@
+! RUN: %clang -x c -o %t.c-part -c %s.c-part
mjklemm wrote:
That has worked. I haven't thought about that at all, so many thanks for the
suggestion. This greatly simplifies things!
https://github.com/llvm/llvm-project/pull/73124
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From ba38aec7ac04c63fd5167908fe7f91d6ac7bceed Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 1/9] Let the linker fail on multiple definitions of main()
---
c
@@ -122,6 +122,7 @@
# the build directory holding that tool.
tools = [
ToolSubst("%flang", command=FindTool("flang-new"), unresolved="fatal"),
+ToolSubst("%clang", command=FindTool("clang"), unresolved="fatal"),
mjklemm wrote:
I have removed this in fa
@@ -0,0 +1,8 @@
+#include
+
+int main(int argc, char * argv[]) {
+// Irrelevant what to do in here.
+// Test is supposed to fail at link time.
+printf("Hello from C [%s]\n", __FUNCTION__);
mjklemm wrote:
This is also gone with the move to an LL file.
@@ -0,0 +1,15 @@
+! UNSUPPORTED: system-windows
+
+! RUN: %clang -o %t.c-object -c %S/Inputs/main_dupes.c
mjklemm wrote:
This change is also gone now and has been removed.
https://github.com/llvm/llvm-project/pull/73124
__
mjklemm wrote:
> LGTM, thank you for taking care of this ππ»
>
> Dare I ask - what's "dupes"? I only found
> [dupe](https://dictionary.cambridge.org/dictionary/english/dupe). Also,
> please wait for @kiranchandramohan to approve before merging this :)
I used "dupes" in the sense of being foole
@@ -0,0 +1,15 @@
+! UNSUPPORTED: system-windows
+
+! RUN: %flang -x ir -o %t.c-object -c %S/Inputs/main_dupes.ll
+! RUN: %flang -o %t -c %s
+! RUN: not %flang -o %t.exe %t %t.c-object 2>&1
mjklemm wrote:
I'd actually prefer to have a separate test for this, as a
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From ba38aec7ac04c63fd5167908fe7f91d6ac7bceed Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/11] Let the linker fail on multiple definitions of main()
---
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/11] Let the linker fail on multiple definitions of main()
---
mjklemm wrote:
FYI: Rebased and resolved conflict flagged by GitHub. Alas, this means that I
have lost the change to also make the linker fail on Windows. I've sent a
request to the authors of the code to perform linking on Windows to help me
figure out what to do.
https://github.com/llvm/l
mjklemm wrote:
> I think for Windows the easy thing to do here is just to add
> `/WHOLEARCHIVE:...` here anyway, using the same logic as in
> processVSRuntimeLibrary(); E.g
>
> ```
> void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
> //need to add args here so we ca
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/12] Let the linker fail on multiple definitions of main()
---
mjklemm wrote:
> I think so yes. The issue is that Windows really wants these things to be in
> the object files rather than passed on the link line, which is what the patch
> you're referencing changed for linking the runtimes at least. Doing that for
> this as well is a little more complex t
@@ -977,14 +977,51 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -977,14 +977,51 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/13] Let the linker fail on multiple definitions of main()
---
mjklemm wrote:
Folks, I have made another attempt to improve this patch. @kparzysz with your
feedback in mind, I have now added a check if `--whole-archive` is active for
some reason. If so, flang will not add it to the link line again.
https://github.com/llvm/llvm-project/pull/73124
___
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/14] Let the linker fail on multiple definitions of main()
---
@@ -977,14 +977,63 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/14] Let the linker fail on multiple definitions of main()
---
@@ -977,14 +977,61 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
@@ -977,14 +977,61 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/16] Let the linker fail on multiple definitions of main()
---
@@ -977,14 +977,61 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
@@ -977,14 +977,61 @@ bool tools::addOpenMPRuntime(ArgStringList &CmdArgs,
const ToolChain &TC,
return true;
}
-void tools::addFortranRuntimeLibs(const ToolChain &TC,
+void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/73124
>From 2a2693364cb8e9b657b9ff54aa78df0466b55fe4 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Wed, 22 Nov 2023 14:22:20 +0100
Subject: [PATCH 01/16] Let the linker fail on multiple definitions of main()
---
mjklemm wrote:
Thanks all for your reviews and the all the feedback you have provided! Much
appreciated!
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
mjklemm wrote:
gfortran and also ifort should fail for codes that have both a program unit and
a makn() function coming from C.
These compilers have a main() function that calls into the Fortran program unit
and link that via an object file.
Id be interested to see the link line for these c
mjklemm wrote:
Here's the reproducer on my system:
```
[2023-12-01 18:36:31 CET] iris ~/tm*/fo*/ftn_main_dupes [0:0] (main *=)>
gfortran -o ftn.o -c ftn.f90 && gcc -o prg.o -c prg.c && gfortran -o ./bla
ftn.o prg.o
/usr/bin/ld: prg.o: in function `main':
prg.c:(.text+0x0): multiple definition
mjklemm wrote:
Ok, got it! I'm fione with reverting this patch and seeking a better solution.
https://github.com/llvm/llvm-project/pull/73124
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c
mjklemm wrote:
> That example is different because you used `program` in the fortran source.
> The use case here is applications which implement `main` in C then call into
> fortran code
Do you have a link line for ifort? It seems that your example fails with
ifort, but indeed works with gfo
mjklemm wrote:
The above fails with ifort/ifx:
```
[2023-12-01 19:00:56 CET] iris ~/tm*/fo*/ftn_main_dupes [0:0] (main *=)> cat >
ftn.f90
function pow(a, b)
real :: a, b, pow
pow = a ** b
end function
[2023-12-01 19:01:03 CET] iris ~/tm*/fo*/ftn_main_dupes [0:0] (main *=)> !if
[2023-12-01 1
mjklemm wrote:
> For what it's worth, `armflang` follows gfortran's behavior.
So does the "old legacy flang", which I guess is the basis for armflang.
AOCC's flang shows the same behavior.
> As there isn't consensus amongst fortran compilers, I'm unsure which behavior
> we should follow. Wh
mjklemm wrote:
BTW, flang legacy has this: ` -fno-fortran-main Don't link in Fortran
main`
Adding that command line option might be the right choice. If everyone agrees,
I can see if I can get this added.
https://github.com/llvm/llvm-project/pull/74120
___
https://github.com/mjklemm created
https://github.com/llvm/llvm-project/pull/74139
This is related to PR #74120 and (merged) PR #73124.
This PR adds the `-fno-fortran-main` command line option to remove
`Fortran_main.a` from the link and to allow for linking Fortran code w/o
program unit with
mjklemm wrote:
I have opened PR #74139 to provide an alternate solution to this. Please have
a look there.
@tblah Would you mind trying this new option with one application code to see
if that will help?
https://github.com/llvm/llvm-project/pull/74120
___
mjklemm wrote:
This WIP for now, as I still have to make the changes for MSVC. But it's good
enough to discuss if this is a viable solution.
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/4] Add -fno-fortran-main driver option
---
clang/include/clang/
https://github.com/mjklemm edited
https://github.com/llvm/llvm-project/pull/74139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/5] Add -fno-fortran-main driver option
---
clang/include/clang/
mjklemm wrote:
> I think this solution is fine, at least in the short term.
>
> I had a think after reviewing the initial patch and looking at the failure
> that @tblah showed in #73124; my thoughts are that the βcorrectβ way of doing
> this would be instead of linking Fortran_main all the tim
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/5] Add -fno-fortran-main driver option
---
clang/include/clang/
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/74139
>From 2e41335a7de3d2efa88eacee659172a3b9525e45 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Fri, 1 Dec 2023 21:41:44 +0100
Subject: [PATCH 1/6] Add -fno-fortran-main driver option
---
clang/include/clang/
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
mjklemm wrote:
https://github.com/mjklemm approved this pull request.
LGTM, but please add to the TODO comment in line 1177 that for AIX a better
solution needs to be found.
https://github.com/llvm/llvm-project/pull/76039
___
cfe-commits mailing list
cfe-commits@lis
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/75816
>From 511f3a4537267284554bf6b33470a01d747b8a94 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Sat, 16 Dec 2023 20:15:17 +0100
Subject: [PATCH 1/5] Remove -lFortran_main from the link line when -shared is
pre
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
mjklemm wrote:
@@ -163,6 +163,40 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/75816
>From 511f3a4537267284554bf6b33470a01d747b8a94 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Sat, 16 Dec 2023 20:15:17 +0100
Subject: [PATCH 1/6] Remove -lFortran_main from the link line when -shared is
pre
@@ -163,6 +163,62 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
@@ -163,6 +163,62 @@ forward compiler options to the frontend driver,
`flang-new -fc1`.
You can read more on the design of `clangDriver` in Clang's [Driver Design &
Internals](https://clang.llvm.org/docs/DriverInternals.html).
+## Linker Driver
+When used as a linker, Flang's
https://github.com/mjklemm updated
https://github.com/llvm/llvm-project/pull/75816
>From 511f3a4537267284554bf6b33470a01d747b8a94 Mon Sep 17 00:00:00 2001
From: Michael Klemm
Date: Sat, 16 Dec 2023 20:15:17 +0100
Subject: [PATCH 1/7] Remove -lFortran_main from the link line when -shared is
pre
1 - 100 of 181 matches
Mail list logo