Skip to content

Commit

Permalink
Fix linking of fortran runtime on Windows to support newer LLVM/flang.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87559 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
kalibera committed Jan 10, 2025
1 parent 447675c commit 5930bab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/gnuwin32/MkRules.rules
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ ifndef USE_LLVM
FLIBS=-lgfortran -lquadmath
else
FC=$(BINPREF)flang $(M_ARCH)
FLIBS=-lFortranRuntime -lFortranDecimal -lFortran_main -lc++
## Fortran_main is needed/available only in some builds of llvm/flang-new
LIBFM = $(or $(and $(wildcard $(EXT_LIBS)/lib/libFortran_main.a),-lFortran_main),)
FLIBS=-lFortranRuntime -lFortranDecimal $(LIBFM) -lc++ -lm
endif
LINKER=$(MAIN_LD)
MAIN_LD=$(CC)
Expand Down
1 change: 1 addition & 0 deletions src/gnuwin32/fixed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fixetc: $(ETC) ../MkRules Makefile
-e "s@NM_FILTER =@NM_FILTER = $(NM_FILTER)@" \
-e "s|LTO =|LTO = $(LTO)|" \
-e "s|LTO_OPT =|LTO_OPT = $(LTO_OPT)|" \
-e "s|FLIBS =|FLIBS = $(FLIBS)|" \
etc/Makeconf > $(R_HOME)/etc$(R_ARCH)/Makeconf
$(SED) -e "s+@BINDIR@+$(BINDIR)+" \
-e "s+@USE_LLVM@+$(USE_LLVM)+" \
Expand Down
3 changes: 1 addition & 2 deletions src/gnuwin32/fixed/etc/Makeconf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ IMPDIR = bin
M_ARCH =
DT_ARCH =
RC_ARCH =
FLIBS =
# Used by packages tcltk and tkrplot
TCL_HOME = $(R_HOME)/Tcl

Expand Down Expand Up @@ -154,10 +155,8 @@ F_VISIBILITY =
## FC is the compiler used for all Fortran as from R 3.6.0
ifdef USE_LLVM
FC = $(BINPREF)flang $(M_ARCH)
FLIBS = -lFortranRuntime -lFortranDecimal -lFortran_main -lc++ -lm
else
FC = $(BINPREF)gfortran $(M_ARCH)
FLIBS = -lgfortran -lm -lquadmath
endif
FCFLAGS = -O3 $(FDEBUGFLAG) @EOPTS@ $(LTO)
## additional libs needed when linking with $(FC), e.g. on some Oracle compilers
Expand Down

0 comments on commit 5930bab

Please sign in to comment.