diff --git a/mk/android.mk b/mk/android.mk index f75358d42c..ee0f583a13 100644 --- a/mk/android.mk +++ b/mk/android.mk @@ -42,6 +42,7 @@ endif RANLIB=${CROSS}ranlib AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive ONELIB=0 OSTYPE=android LINK= diff --git a/mk/armel.mk b/mk/armel.mk index 43b8103f98..9914c9b5cb 100644 --- a/mk/armel.mk +++ b/mk/armel.mk @@ -8,6 +8,7 @@ USERCC=${CROSS}gcc AR=${CROSS}ar RANLIB=${CROSS}ranlib CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive ONELIB=0 OSTYPE=gnulinux diff --git a/mk/clang.mk b/mk/clang.mk index 62af802291..56d6da9f5c 100644 --- a/mk/clang.mk +++ b/mk/clang.mk @@ -17,11 +17,13 @@ CFLAGS_DEBUG=-g ifeq ($(OSTYPE),darwin) ARCH=$(shell uname -m) +PARTIALLD=ld -r -all_load #CFLAGS+=-arch ${ARCH} #LDFLAGS+=-arch ${ARCH} LDFLAGS_LIB=-dynamiclib LDFLAGS_SONAME=-Wl,-install_name,${LIBDIR}/ else +PARTIALLD=ld -r --whole-archive LDFLAGS_LIB=${LDFLAGS} -shared #ifneq (${NAME},) #LDFLAGS_LIB+=-Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION} diff --git a/mk/emscripten.mk b/mk/emscripten.mk index 4229abd6ab..799fb5d4fe 100644 --- a/mk/emscripten.mk +++ b/mk/emscripten.mk @@ -9,6 +9,7 @@ LINK= RANLIB=emranlib ONELIB=0 CC_AR=emar q ${LIBAR} +PARTIALLD=emld -r PIC_CFLAGS=-fPIC CFLAGS+=-MD CFLAGS_INCLUDE=-I diff --git a/mk/gcc.mk b/mk/gcc.mk index 76f4c868bc..9e2c46c778 100644 --- a/mk/gcc.mk +++ b/mk/gcc.mk @@ -19,10 +19,12 @@ ifeq ($(OSTYPE),darwin) ARCH=$(shell uname -m) #CFLAGS+=-arch ${ARCH} #LDFLAGS+=-arch ${ARCH} +PARTIALLD=ld -r -all_load CFLAGS+=-fno-common LDFLAGS_LIB=-dynamiclib LDFLAGS_SONAME=-Wl,-install_name,${LIBDIR}/ else +PARTIALLD=ld -r --whole-archive LDFLAGS_LIB=${LDFLAGS} -shared #ifneq (${NAME},) #LDFLAGS_LIB+=-Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION} diff --git a/mk/i386-mingw32-gcc.mk b/mk/i386-mingw32-gcc.mk index eca16cd74e..13746de980 100644 --- a/mk/i386-mingw32-gcc.mk +++ b/mk/i386-mingw32-gcc.mk @@ -8,6 +8,7 @@ ONELIB=0 LINK=-shared AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i486-mingw32-gcc.mk b/mk/i486-mingw32-gcc.mk index fbcd790391..812bd1b88b 100644 --- a/mk/i486-mingw32-gcc.mk +++ b/mk/i486-mingw32-gcc.mk @@ -8,6 +8,7 @@ ONELIB=0 LINK=-shared AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i586-mingw32-gcc.mk b/mk/i586-mingw32-gcc.mk index eabee81cc6..69391caee1 100644 --- a/mk/i586-mingw32-gcc.mk +++ b/mk/i586-mingw32-gcc.mk @@ -8,6 +8,7 @@ OSTYPE=windows LINK=-shared AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i586-mingw32msvc-gcc.mk b/mk/i586-mingw32msvc-gcc.mk index 11db55109e..25e04bb56f 100644 --- a/mk/i586-mingw32msvc-gcc.mk +++ b/mk/i586-mingw32msvc-gcc.mk @@ -7,6 +7,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i686-pc-mingw32-gcc.mk b/mk/i686-pc-mingw32-gcc.mk index fa129acd57..584d3c5196 100644 --- a/mk/i686-pc-mingw32-gcc.mk +++ b/mk/i686-pc-mingw32-gcc.mk @@ -7,6 +7,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i686-unknown-mingw32_nt-6.2-gnu.mk b/mk/i686-unknown-mingw32_nt-6.2-gnu.mk index 9fea691561..dca12db9dd 100644 --- a/mk/i686-unknown-mingw32_nt-6.2-gnu.mk +++ b/mk/i686-unknown-mingw32_nt-6.2-gnu.mk @@ -8,6 +8,7 @@ OSTYPE=windows LINK= AR=ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i686-w64-mingw32-gcc.mk b/mk/i686-w64-mingw32-gcc.mk index 70604ea8f6..e2d3d87d06 100644 --- a/mk/i686-w64-mingw32-gcc.mk +++ b/mk/i686-w64-mingw32-gcc.mk @@ -8,6 +8,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/i686-w64-mingw32.static-gcc.mk b/mk/i686-w64-mingw32.static-gcc.mk index 7c0ba0edfc..39ed89d85f 100644 --- a/mk/i686-w64-mingw32.static-gcc.mk +++ b/mk/i686-w64-mingw32.static-gcc.mk @@ -8,6 +8,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/ios-sdk.mk b/mk/ios-sdk.mk index 4ce8111e7e..60dc9998f3 100644 --- a/mk/ios-sdk.mk +++ b/mk/ios-sdk.mk @@ -7,6 +7,7 @@ OSTYPE=darwin LINK= AR=ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r -all_load PICFLAGS= CFLAGS+=${PICFLAGS} CC_LIB=${CC} -shared -o diff --git a/mk/mingw32-gcc-5.3.0.mk b/mk/mingw32-gcc-5.3.0.mk index 2e3e3903a0..d09bc81889 100644 --- a/mk/mingw32-gcc-5.3.0.mk +++ b/mk/mingw32-gcc-5.3.0.mk @@ -7,6 +7,7 @@ ONELIB=0 LINK=-shared AR=mingw32-gcc-ar CC_AR=${AR} ${LIBAR} +PARTIALLD=mingw32-gcc-ld -r --whole-archive PICFLAGS= #CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CFLAGS+=${PICFLAGS} -D__WINDOWS__=1 diff --git a/mk/mipsel.mk b/mk/mipsel.mk index 7d29961f41..4332ab4cce 100644 --- a/mk/mipsel.mk +++ b/mk/mipsel.mk @@ -8,6 +8,7 @@ USERCC=${CROSS}gcc RANLIB=${CROSS}ranlib AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive ONELIB=0 OSTYPE=gnulinux diff --git a/mk/qnx.mk b/mk/qnx.mk index dabf661140..7c242c0cb1 100644 --- a/mk/qnx.mk +++ b/mk/qnx.mk @@ -6,6 +6,7 @@ OSTYPE=qnx LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} CC_LIB=${CC} -shared -o diff --git a/mk/tcc.mk b/mk/tcc.mk index 1df0c8f260..0e1b353929 100644 --- a/mk/tcc.mk +++ b/mk/tcc.mk @@ -14,9 +14,11 @@ CFLAGS_OPT2=-O2 CFLAGS_OPT3=-O3 ifeq ($(OSTYPE),darwin) +PARTIALLD=ld -r -all_load LDFLAGS_LIB=-dynamiclib LDFLAGS_SONAME=-Wl,-install_name, else +PARTIALLD=ld -r --whole-archive LDFLAGS_LIB=-shared LDFLAGS_LIB+=-Dxx #Wl,-soname,lib${NAME}.${EXT_SO}.${VERSION} diff --git a/mk/termux.mk b/mk/termux.mk index 8a581cd186..3340b6e22e 100644 --- a/mk/termux.mk +++ b/mk/termux.mk @@ -7,6 +7,7 @@ ARCH=arm RANLIB=ranlib AR=ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=ld -r --whole-archive ONELIB=0 OSTYPE=android diff --git a/mk/wasm.mk b/mk/wasm.mk index 1a4764b66c..87ae69924d 100644 --- a/mk/wasm.mk +++ b/mk/wasm.mk @@ -9,6 +9,7 @@ LINK= RANLIB=emranlib ONELIB=0 CC_AR=emar q ${LIBAR} +PARTIALLD=emld -r PIC_CFLAGS=-fPIC CFLAGS+=-MD CFLAGS_INCLUDE=-I diff --git a/mk/x86_64-w64-mingw32-gcc.mk b/mk/x86_64-w64-mingw32-gcc.mk index 0830cb49a8..b2de8b1e63 100644 --- a/mk/x86_64-w64-mingw32-gcc.mk +++ b/mk/x86_64-w64-mingw32-gcc.mk @@ -6,6 +6,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o diff --git a/mk/x86_64-w64-mingw32.static-gcc.mk b/mk/x86_64-w64-mingw32.static-gcc.mk index 9d31932122..54efb4be95 100644 --- a/mk/x86_64-w64-mingw32.static-gcc.mk +++ b/mk/x86_64-w64-mingw32.static-gcc.mk @@ -7,6 +7,7 @@ OSTYPE=windows LINK= AR=${CROSS}ar CC_AR=${AR} -r ${LIBAR} +PARTIALLD=${CROSS}ld -r --whole-archive PICFLAGS= CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1 CC_LIB=${CC} -shared -o