Skip to content

Commit 2f39e8a

Browse files
committed
[flang][Driver] Enable FLANG_DEFAULT_LINKER
1 parent 29e8599 commit 2f39e8a

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

flang/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ if (NOT ENABLE_LINKER_BUILD_ID)
317317
set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
318318
endif()
319319

320-
set(FLANG_DEFAULT_LINKER "" CACHE STRING
320+
set(FLANG_DEFAULT_LINKER ${CLANG_DEFAULT_LINKER} CACHE STRING
321321
"Default linker to use (linker name or absolute path, empty for platform default)")
322322

323323
set(FLANG_DEFAULT_RTLIB "" CACHE STRING
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#===-- include/flang/Config/config.h.cmake ---------------------------------===#
2-
#
3-
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
# See https://llvm.org/LICENSE.txt for license information.
5-
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
#
7-
#===------------------------------------------------------------------------===#
1+
//===-- include/flang/Config/config.h.cmake -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
88

99
/* This generated file is for internal use. Do not include it from headers. */
1010

@@ -16,6 +16,8 @@
1616

1717
#define FLANG_VERSION "${FLANG_VERSION}"
1818

19+
#define FLANG_DEFAULT_LINKER "${FLANG_DEFAULT_LINKER}"
20+
1921
#endif
2022

2123

flang/test/Driver/linker-flags.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
! MINGW-SAME: -lflang_rt.runtime
7878
! MINGW-STATIC-FLANGRT: "{{.*}}{{\\|/}}libflang_rt.runtime.a"
7979

80-
! NOTE: This also matches lld-link (when CLANG_DEFAULT_LINKER=lld) and
80+
! NOTE: This also matches lld-link (when FLANG_DEFAULT_LINKER=lld) and
8181
! any .exe suffix that is added when resolving to the full path of
8282
! (lld-)link.exe on Windows platforms. The suffix may not be added
8383
! when the executable is not found or on non-Windows platforms.

flang/tools/flang-driver/driver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//===----------------------------------------------------------------------===//
1717

1818
#include "clang/Driver/Driver.h"
19+
#include "flang/Config/config.h"
1920
#include "flang/Frontend/CompilerInvocation.h"
2021
#include "flang/Frontend/TextDiagnosticPrinter.h"
2122
#include "clang/Basic/Diagnostic.h"
@@ -138,6 +139,7 @@ int main(int argc, const char **argv) {
138139
llvm::sys::getDefaultTargetTriple(), diags,
139140
"flang LLVM compiler");
140141
theDriver.setTargetAndMode(targetandMode);
142+
theDriver.setPreferredLinker(FLANG_DEFAULT_LINKER);
141143
#ifdef FLANG_RUNTIME_F128_MATH_LIB
142144
theDriver.setFlangF128MathLibrary(FLANG_RUNTIME_F128_MATH_LIB);
143145
#endif

0 commit comments

Comments
 (0)