Skip to content

Commit

Permalink
Application.mk: Link the compiler runtime for ELF modules
Browse files Browse the repository at this point in the history
An alternative is to have symbols like __udivdi3 in
the symbol table explicitly when loading the module.
But I feel it's too cumbersome to maintain.
  • Loading branch information
yamt authored and xiaoxiang781216 committed Feb 3, 2022
1 parent 836cd05 commit 09d7785
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ ifneq ($(CONFIG_BUILD_KERNEL),y)
endif
endif

# When building a module, link with the compiler runtime.
# This should be linked after libapps. Consider that mbedtls in libapps
# uses __udivdi3.
ifeq ($(BUILD_MODULE),y)
# Revisit: This only works for gcc and clang.
# Do other compilers have similar?
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)
ifneq ($(COMPILER_RT_LIB),)
LDLIBS += $(COMPILER_RT_LIB)
endif
endif

SUFFIX = $(subst $(DELIM),.,$(CWD))
PROGNAME := $(shell echo $(PROGNAME))

Expand Down

0 comments on commit 09d7785

Please sign in to comment.