From bb75c67563d6dc8920507909779f394d6760dd81 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 10 Apr 2020 08:50:45 +0200 Subject: grt: separate exec and all link options. For #640 --- src/grt/Makefile.inc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/grt') 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 -- cgit v1.2.3