3 Commits

Author SHA1 Message Date
David Truby
8cb0c3bb21 [flang] Add COMDAT to global variables where needed
On platforms which support COMDAT sections we should use them when
linkonce or linkonce_odr linkage is requested. This is required on
Windows (PE/COFF) and provides better behaviour than weak symbols on
ELF-based platforms.

This patch also reverts string literals to use linkonce instead of
internal linkage now that comdats are supported.

Differential Revision: https://reviews.llvm.org/D153768
2023-06-28 13:49:30 +01:00
David Truby
28dc5f4cdd [flang] Use internal linkage for string literals
On Windows, global string literals with "linkonce" linkage is not
supported without using comdat. As a simpler fix than adding comdat
support we can use internal linkage instead.

This fixes a bug where two string literals with the same value in
different fortran files would cause a linker error due to the use
of linkonce linkage.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D149859
2023-05-11 15:47:20 +01:00
Valentin Clement
e539faced8
[flang][NFC] Add global lowering tests
This patch adds some lowering tests for globals.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122322

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 17:02:15 +01:00