diff options
| author | Jason Evans <jasone@canonware.com> | 2014-01-22 19:11:22 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2014-01-22 19:11:22 (GMT) |
| commit | cc47dde16203a6ae7eb685b53e1ae501f3869bc6 (patch) | |
| tree | 74e81d65651b2ca7e294a857797dda6635177454 /include/jemalloc/jemalloc_mangle.sh | |
| parent | 0135fb806e4137dc9cdf152541926a2bc95e33f0 (diff) | |
| parent | 798a48103014aabf8afb3d7efff90399a466dd8c (diff) | |
| download | jemalloc-3.5.0.zip jemalloc-3.5.0.tar.gz jemalloc-3.5.0.tar.bz2 | |
Merge branch 'dev'3.5.0
Diffstat (limited to 'include/jemalloc/jemalloc_mangle.sh')
| -rwxr-xr-x | include/jemalloc/jemalloc_mangle.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/jemalloc/jemalloc_mangle.sh b/include/jemalloc/jemalloc_mangle.sh new file mode 100755 index 0000000..df328b7 --- /dev/null +++ b/include/jemalloc/jemalloc_mangle.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +public_symbols_txt=$1 +symbol_prefix=$2 + +cat <<EOF +/* + * By default application code must explicitly refer to mangled symbol names, + * so that it is possible to use jemalloc in conjunction with another allocator + * in the same application. Define JEMALLOC_MANGLE in order to cause automatic + * name mangling that matches the API prefixing that happened as a result of + * --with-mangling and/or --with-jemalloc-prefix configuration settings. + */ +#ifdef JEMALLOC_MANGLE +# ifndef JEMALLOC_NO_DEMANGLE +# define JEMALLOC_NO_DEMANGLE +# endif +EOF + +for nm in `cat ${public_symbols_txt}` ; do + n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` + echo "# define ${n} ${symbol_prefix}${n}" +done + +cat <<EOF +#endif + +/* + * The ${symbol_prefix}* macros can be used as stable alternative names for the + * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily + * meant for use in jemalloc itself, but it can be used by application code to + * provide isolation from the name mangling specified via --with-mangling + * and/or --with-jemalloc-prefix. + */ +#ifndef JEMALLOC_NO_DEMANGLE +EOF + +for nm in `cat ${public_symbols_txt}` ; do + n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` + echo "# undef ${symbol_prefix}${n}" +done + +cat <<EOF +#endif +EOF |
