diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS index 29af74174..ea68406f2 100644 --- a/docs/CONTRIBUTORS +++ b/docs/CONTRIBUTORS @@ -55,6 +55,7 @@ Jamie Iles Jan Van Winkel Jean Berniolles Jeremy Bennett +Jevin Sweval Jiacheng Qian Jiuyang Liu John Coiner diff --git a/include/verilated.mk.in b/include/verilated.mk.in index 9dcff5121..8145de6c8 100644 --- a/include/verilated.mk.in +++ b/include/verilated.mk.in @@ -46,6 +46,10 @@ ifneq ($(words $(CURDIR)),1) $(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)') endif +###################################################################### +# OS detection +UNAME_S := $(shell uname -s) + ###################################################################### # C Preprocessor flags @@ -78,6 +82,12 @@ CPPFLAGS += $(OPT) CPPFLAGS += $(M32) LDFLAGS += $(M32) +# On macOS, specify all weak symbols as dynamic_lookup. +# Otherwise, you get undefined symbol errors. +ifeq ($(UNAME_S),Darwin) + LDFLAGS += -Wl,-U,__Z15vl_time_stamp64v,-U,__Z13sc_time_stampv +endif + # Allow upper level user makefiles to specify flags they want. # These aren't ever set by Verilator, so users are free to override them. CPPFLAGS += $(USER_CPPFLAGS) diff --git a/include/verilatedos.h b/include/verilatedos.h index 5ccd8e019..82f39518b 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -54,6 +54,7 @@ # define VL_ATTR_PURE __attribute__((pure)) # define VL_ATTR_UNUSED __attribute__((unused)) # if !defined(_WIN32) && !defined(__MINGW32__) +// All VL_ATTR_WEAK symbols must be marked with the macOS -U linker flag in verilated.mk.in # define VL_ATTR_WEAK __attribute__((weak)) # endif # if defined(__clang__)