File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,22 @@ if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSIO
73
73
endif ()
74
74
75
75
if (LLVM_TREE_AVAILABLE )
76
+ # In a bootstrap build emit the libraries into a default search path in the
77
+ # build directory of the just-built compiler. This allows using the
78
+ # just-built compiler without specifying paths to runtime libraries.
79
+ #
76
80
# Despite Clang in the name, get_clang_resource_dir does not depend on Clang
77
81
# being added to the build. Flang uses the same resource dir as clang.
78
82
include (GetClangResourceDir )
79
83
get_clang_resource_dir (FLANG_RT_BUILD_LIB_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR} /.." SUBDIR "lib${LLVM_LIBDIR_SUFFIX} " )
80
84
get_clang_resource_dir (FLANG_RT_INSTALL_LIB_DIR SUBDIR "lib${LLVM_LIBDIR_SUFFIX} " ) # No prefix, CMake's install command finds the install prefix itself
81
85
else ()
82
- set (FLANG_RT_BUILD_LIB_DIR "${LLVM_LIBRARY_OUTPUT_INTDIR} " )
86
+ # In a runtimes build never write into LLVM's build dir. It might be reused
87
+ # for mutliple Flang-RT builds (e.g. Debug/Release). Instead create our own
88
+ # library directory.
89
+ #
90
+ # TODO: Support multi-config generators
91
+ set (FLANG_RT_BUILD_LIB_DIR "${CMAKE_BINARY_DIR} /lib${LLVM_LIBDIR_SUFFIX} " )
83
92
set (FLANG_RT_INSTALL_LIB_DIR "lib${LLVM_LIBDIR_SUFFIX} " )
84
93
endif ()
85
94
Original file line number Diff line number Diff line change 1
1
! UNSUPPORTED: system-windows
2
2
! RUN: split-file %s %t
3
3
! RUN: chmod +x %t/runtest.sh
4
- ! RUN: %t/runtest.sh %t %t/ffile.f90 %t/cfile.c %flang | FileCheck %s
4
+ ! RUN: %t/runtest.sh %t %t/ffile.f90 %t/cfile.c %flang %libdir | FileCheck %s
5
5
6
6
!- -- ffile.f90
7
7
program fmain
@@ -71,16 +71,16 @@ end subroutine foo
71
71
FFILE= $2
72
72
CFILE= $3
73
73
FLANG= $4
74
- shift 4
74
+ LIBDIR= $5
75
+ shift 5
75
76
FLAGS= " $*"
76
77
BINDIR= `dirname $FLANG`
77
- LIBDIR= $BINDIR/ ../ lib
78
78
CCOMP= $BINDIR/ clang
79
79
if [ - x $CCOMP ]
80
80
then
81
81
export LD_LIBRARY_PATH= $LD_LIBRARY_PATH:$LIBDIR
82
82
$CCOMP $FLAGS - c $CFILE - o $TMPDIR/ cfile.o
83
- $FLANG $FLAGS $FFILE $TMPDIR/ cfile.o - o $TMPDIR/ ctofortran
83
+ $FLANG $FLAGS $FFILE $TMPDIR/ cfile.o - o $TMPDIR/ ctofortran - L " ${LIBDIR} "
84
84
$TMPDIR/ ctofortran # should print " PASS"
85
85
else
86
86
# No clang compiler, just pass by default
Original file line number Diff line number Diff line change 1
1
! Verify that flang can correctly build executables.
2
2
3
- ! RUN: %flang %s -o %t
4
- ! RUN: env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%llvmshlibdir " %t | FileCheck %s
3
+ ! RUN: %flang -L"%libdir" %s -o %t
4
+ ! RUN: env LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%libdir " %t | FileCheck %s
5
5
! RUN: rm -f %t
6
6
7
7
! CHECK: Hello, World!
Original file line number Diff line number Diff line change 70
70
)
71
71
]
72
72
73
+ tools .append (ToolSubst ("%libdir" , command = config .flangrt_build_lib_dir , unresolved = "fatal" ))
74
+
73
75
# Define some variables to help us test that the flang runtime doesn't depend on
74
76
# the C++ runtime libraries. For this we need a C compiler.
75
77
libruntime = os .path .join (config .flangrt_build_lib_dir , "libflang_rt.a" )
You can’t perform that action at this time.
0 commit comments