aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-10 08:50:45 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-10 08:50:45 +0200
commitbb75c67563d6dc8920507909779f394d6760dd81 (patch)
treea0b4e086a7471ccfccef6ba30bfcfaccda99884f /src/grt
parentcaa5bf5c2a32e31f07209490a8933cfa186e9511 (diff)
downloadghdl-bb75c67563d6dc8920507909779f394d6760dd81.tar.gz
ghdl-bb75c67563d6dc8920507909779f394d6760dd81.tar.bz2
ghdl-bb75c67563d6dc8920507909779f394d6760dd81.zip
grt: separate exec and all link options. For #640
Diffstat (limited to 'src/grt')
-rw-r--r--src/grt/Makefile.inc26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/grt/Makefile.inc b/src/grt/Makefile.inc
index abea76a45..340eb9eb2 100644
--- a/src/grt/Makefile.inc
+++ b/src/grt/Makefile.inc
@@ -46,17 +46,35 @@ endif
GRT_ELF_OPTS:=-Wl,--version-script=@/grt.ver -Wl,--export-dynamic
+# These conditions define 3 variables:
+# GRT_TARGET_OBJS: platform specific files to be added in the grt library
+# GRT_EXTRA_LIBS: platform specific libraries and options to be added during
+# link of simulation binaries. These are library used by grt.
+# GRT_EXEC_OPTS: platform specific options to be added during link of
+# simulation binaries, but not needed when creating a shared library.
+# It is set on ELF platforms to export some symbols (like the vpi
+# functions) so that a vpi object file can refer them.
# Set target files.
ifeq ($(filter-out mingw32 mingw64,$(osys)),)
+ # For windows.
GRT_TARGET_OBJS=win32.o clock.o
GRT_EXTRA_LIB=-ldbghelp
+ GRT_EXEC_OPTS=
else
+ # For unix variants.
+ # Usually needs -dl (for dlopen) and -lm (for math functions).
+ # But some platforms provide these features within libc.
GRT_TARGET_OBJS=jumps.o times.o
+ GRT_EXTRA_LIB=
+ GRT_EXEC_OPTS=
+
ifeq ($(filter-out linux%,$(osys)),)
- GRT_EXTRA_LIB=-ldl -lm $(GRT_ELF_OPTS)
+ GRT_EXTRA_LIB=-ldl -lm
+ GRT_EXEC_OPTS=$(GRT_ELF_OPTS)
endif
ifeq ($(filter-out netbsd freebsd% dragonfly%,$(osys)),)
- GRT_EXTRA_LIB=-lm $(GRT_ELF_OPTS)
+ GRT_EXTRA_LIB=-lm
+ GRT_EXEC_OPTS=$(GRT_ELF_OPTS)
endif
ifeq ($(filter-out solaris%,$(osys)),)
GRT_EXTRA_LIB=-ldl -lm
@@ -229,9 +247,7 @@ grt/grt-files.in: grt/grt-files
$(libdirsuffix)/grt.lst: grt/grt-files.in
echo "@/libgrt.a" > $@
-ifdef GRT_EXTRA_LIB
- for i in $(GRT_EXTRA_LIB); do echo $$i >> $@; done
-endif
+ for i in $(GRT_EXTRA_LIB) $(GRT_EXEC_OPTS); do echo $$i >> $@; done
ifneq ($(LIBBACKTRACE),)
echo "@/libbacktrace.a" >> $@
endif