unbreak symbol weakening
It is kinda minor feature, and apparently we never had it working. But is a nice to have. Allows our users to override malloc/free/etc while still being able to link to us (for tc_malloc for example). With broken weakening we had this use-case broken for static library case. And it should now work.
This commit is contained in:
parent
630dac81ea
commit
a39073886a
14
Makefile.am
14
Makefile.am
|
@ -73,9 +73,6 @@ endif MINGW
|
||||||
# can override our malloc if they want to (they can still use tc_malloc).
|
# can override our malloc if they want to (they can still use tc_malloc).
|
||||||
# Note: the weird-looking symbols are the c++ memory functions:
|
# Note: the weird-looking symbols are the c++ memory functions:
|
||||||
# (in order) new, new(nothrow), new[], new[](nothrow), delete, delete[]
|
# (in order) new, new(nothrow), new[], new[](nothrow), delete, delete[]
|
||||||
# In theory this will break if mangling changes, but that seems pretty
|
|
||||||
# unlikely at this point. Just in case, I throw in versions with an
|
|
||||||
# extra underscore as well, which may help on OS X.
|
|
||||||
if HAVE_OBJCOPY_WEAKEN
|
if HAVE_OBJCOPY_WEAKEN
|
||||||
WEAKEN = $(OBJCOPY) -W malloc -W free -W realloc -W calloc -W cfree \
|
WEAKEN = $(OBJCOPY) -W malloc -W free -W realloc -W calloc -W cfree \
|
||||||
-W memalign -W posix_memalign -W valloc -W pvalloc \
|
-W memalign -W posix_memalign -W valloc -W pvalloc \
|
||||||
|
@ -84,7 +81,16 @@ WEAKEN = $(OBJCOPY) -W malloc -W free -W realloc -W calloc -W cfree \
|
||||||
-W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t \
|
-W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t \
|
||||||
-W _ZdlPv -W _ZdaPv \
|
-W _ZdlPv -W _ZdaPv \
|
||||||
-W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t \
|
-W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t \
|
||||||
-W __ZdlPv -W __ZdaPv
|
-W __ZdlPv -W __ZdaPv \
|
||||||
|
-W _ZdaPvRKSt9nothrow_t -W _ZdaPvSt11align_val_t \
|
||||||
|
-W _ZdaPvSt11align_val_tRKSt9nothrow_t -W _ZdaPvm \
|
||||||
|
-W _ZdaPvmSt11align_val_t -W _ZdlPvRKSt9nothrow_t \
|
||||||
|
-W _ZdlPvSt11align_val_t -W _ZdlPvSt11align_val_tRKSt9nothrow_t \
|
||||||
|
-W _ZdlPvm -W _ZdlPvmSt11align_val_t \
|
||||||
|
-W _ZnamSt11align_val_t -W _ZnamSt11align_val_tRKSt9nothrow_t \
|
||||||
|
-W _ZnwmSt11align_val_t -W _ZnwmSt11align_val_tRKSt9nothrow_t \
|
||||||
|
-W malloc_size -W malloc_usable_size
|
||||||
|
|
||||||
else
|
else
|
||||||
WEAKEN = :
|
WEAKEN = :
|
||||||
endif !HAVE_OBJCOPY_WEAKEN
|
endif !HAVE_OBJCOPY_WEAKEN
|
||||||
|
|
|
@ -50,5 +50,14 @@ function(weaken_object target)
|
||||||
-W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t
|
-W _Znwm -W _ZnwmRKSt9nothrow_t -W _Znam -W _ZnamRKSt9nothrow_t
|
||||||
-W _ZdlPv -W _ZdaPv
|
-W _ZdlPv -W _ZdaPv
|
||||||
-W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t
|
-W __Znwm -W __ZnwmRKSt9nothrow_t -W __Znam -W __ZnamRKSt9nothrow_t
|
||||||
-W __ZdlPv -W __ZdaPv "$<TARGET_FILE:${target}>")
|
-W __ZdlPv -W __ZdaPv
|
||||||
|
-W _ZdaPvRKSt9nothrow_t -W _ZdaPvSt11align_val_t
|
||||||
|
-W _ZdaPvSt11align_val_tRKSt9nothrow_t -W _ZdaPvm
|
||||||
|
-W _ZdaPvmSt11align_val_t -W _ZdlPvRKSt9nothrow_t
|
||||||
|
-W _ZdlPvSt11align_val_t -W _ZdlPvSt11align_val_tRKSt9nothrow_t
|
||||||
|
-W _ZdlPvm -W _ZdlPvmSt11align_val_t
|
||||||
|
-W _ZnamSt11align_val_t -W _ZnamSt11align_val_tRKSt9nothrow_t
|
||||||
|
-W _ZnwmSt11align_val_t -W _ZnwmSt11align_val_tRKSt9nothrow_t
|
||||||
|
-W malloc_size -W malloc_usable_size
|
||||||
|
"$<TARGET_FILE:${target}>")
|
||||||
endfunction()
|
endfunction()
|
|
@ -199,7 +199,7 @@ AX_CXX_COMPILE_STDCXX(11, ext, mandatory)
|
||||||
AC_CHECK_TOOL([OBJCOPY], [objcopy], [])
|
AC_CHECK_TOOL([OBJCOPY], [objcopy], [])
|
||||||
AS_IF([test -n "$OBJCOPY"], [dnl
|
AS_IF([test -n "$OBJCOPY"], [dnl
|
||||||
AC_CACHE_CHECK([if $OBJCOPY supports -W], gpt_cv_objcopy_weaken, [dnl
|
AC_CACHE_CHECK([if $OBJCOPY supports -W], gpt_cv_objcopy_weaken, [dnl
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([void foo() {} int main() {return 0;}])], [dnl
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([void foo() {}])], [dnl
|
||||||
AS_IF(["$OBJCOPY" -W foo conftest$ac_exeext /dev/null],
|
AS_IF(["$OBJCOPY" -W foo conftest$ac_exeext /dev/null],
|
||||||
[gpt_cv_objcopy_weaken=yes], [gpt_cv_objcopy_weaken=no])],
|
[gpt_cv_objcopy_weaken=yes], [gpt_cv_objcopy_weaken=no])],
|
||||||
[gpt_cv_objcopy_weaken=no])])],
|
[gpt_cv_objcopy_weaken=no])])],
|
||||||
|
|
Loading…
Reference in New Issue