aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in5
-rwxr-xr-xconfigure23
-rw-r--r--src/ortho/llvm/Makefile2
3 files changed, 19 insertions, 11 deletions
diff --git a/Makefile.in b/Makefile.in
index 1e6c34214..7efa305ea 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -25,6 +25,7 @@ libdirsuffix=@libdirsuffix@
libdirreverse=@libdirreverse@
gcc_src_dir=@gcc_src_dir@
llvm_prefix=@llvm_prefix@
+LDFLAGS=@LDFLAGS@
INSTALL_PROGRAM=install -m 755
INSTALL_DATA=install -m 644
@@ -187,7 +188,7 @@ ghdl_llvm_jit: $(GRT_ADD_OBJS) $(ORTHO_DEPS) llvm-cbindings.o force
$(GNATMAKE) -o $@ $(GHDL_LLVM_INCFLAGS) $(GNATFLAGS) ghdl_jit.adb \
$(GNAT_BARGS) -largs llvm-cbindings.o $(GNAT_LARGS) $(GRT_ADD_OBJS) \
$(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) --LINK=$(CXX) \
- `$(LLVM_CONFIG) --ldflags --libs --system-libs`
+ `$(LLVM_CONFIG) --ldflags --libs --system-libs` $(LDFLAGS)
llvm-cbindings.o: $(srcdir)/src/ortho/llvm/llvm-cbindings.cpp
$(CXX) -c `$(LLVM_CONFIG) --includedir --cxxflags` \
@@ -207,7 +208,7 @@ ghdl_llvm: force
ghdl1-llvm: force
$(MAKE) -f $(srcdir)/src/ortho/llvm/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
- GNAT_FLAGS="$(GHDL_LLVM_INCFLAGS) $(GNATFLAGS)" \
+ GNAT_FLAGS="$(GHDL_LLVM_INCFLAGS) $(GNATFLAGS)" LDFLAGS="$(LDFLAGS)" \
LLVM_CONFIG="$(LLVM_CONFIG)" all
oread-llvm: force
diff --git a/configure b/configure
index 875a238b8..a5be5d6bb 100755
--- a/configure
+++ b/configure
@@ -7,6 +7,7 @@ backend=mcode
CC=${CC:-gcc}
CFLAGS=${CFLAGS:--g}
GNATMAKE=${GNATMAKE:-gnatmake}
+LDFLAGS=
prefix=/usr/local
libdirsuffix=lib/ghdl
libdirreverse=../..
@@ -18,7 +19,7 @@ build=
show_help=no
progname=$0
-subst_vars="CC GNATMAKE CFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_prefix"
+subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_prefix"
# Find srcdir
srcdir=`dirname $progname`
@@ -86,6 +87,12 @@ if ! $CC -v 2> /dev/null; then
exit 1
fi
+# Compute build machine
+if test x$build = x; then
+ build=`$CC $CFLAGS -dumpmachine`
+fi
+echo "Build machine is: $build"
+
# For mcode, check that gcc emits i386
if test $backend = mcode; then
if ! $CC $CFLAGS -dumpmachine | grep -q "[3-6]86"; then
@@ -111,18 +118,18 @@ fi
# For llvm backend, check llvm-config
if test $backend = llvm; then
llvm_cmd="$llvm_prefix/bin/llvm-config --version"
- if ! $llvm_cmd 2> /dev/null; then
+ if ! $llvm_cmd > /dev/null 2>&1; then
echo "cannot run $llvm_cmd"
exit 1
fi
+ # For llvm, the c++ compiler is for linking so that the standard c++
+ # library is included. However, the linker needs the no_compact_unwind
+ # flag because code generated by gcc is not compatible with compact unwind.
+ case "$build" in
+ *darwin*) LDFLAGS="$LDFLAGS -Wl,-no_compact_unwind" ;;
+ esac
fi
-# Compute build machine
-if test x$build = x; then
- build=`$CC $CFLAGS -dumpmachine`
-fi
-echo "Build machine is: $build"
-
# Generate config.status
rm -f config.status
{
diff --git a/src/ortho/llvm/Makefile b/src/ortho/llvm/Makefile
index fcf89d3ae..a9a9bdcf6 100644
--- a/src/ortho/llvm/Makefile
+++ b/src/ortho/llvm/Makefile
@@ -11,7 +11,7 @@ $(ortho_exec): $(ortho_srcdir)/llvm/ortho_llvm.ads force llvm-cbindings.o
gnatmake -o $@ -aI$(ortho_srcdir)/llvm -aI$(ortho_srcdir) \
$(GNAT_FLAGS) ortho_code_main -bargs -E \
-largs llvm-cbindings.o --LINK=$(CXX) \
- `$(LLVM_CONFIG) --ldflags --libs --system-libs`
+ `$(LLVM_CONFIG) --ldflags --libs --system-libs` $(LDFLAGS)
llvm-cbindings.o: $(ortho_srcdir)/llvm/llvm-cbindings.cpp
$(CXX) -c -I`$(LLVM_CONFIG) --includedir --cflags --cxxflags` -o $@ $<