Blame jemalloc/include/jemalloc/jemalloc_mangle.sh
|
Packit |
345191 |
#!/bin/sh -eu
|
|
Packit |
345191 |
|
|
Packit |
345191 |
public_symbols_txt=$1
|
|
Packit |
345191 |
symbol_prefix=$2
|
|
Packit |
345191 |
|
|
Packit |
345191 |
cat <
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* By default application code must explicitly refer to mangled symbol names,
|
|
Packit |
345191 |
* so that it is possible to use jemalloc in conjunction with another allocator
|
|
Packit |
345191 |
* in the same application. Define JEMALLOC_MANGLE in order to cause automatic
|
|
Packit |
345191 |
* name mangling that matches the API prefixing that happened as a result of
|
|
Packit |
345191 |
* --with-mangling and/or --with-jemalloc-prefix configuration settings.
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
#ifdef JEMALLOC_MANGLE
|
|
Packit |
345191 |
# ifndef JEMALLOC_NO_DEMANGLE
|
|
Packit |
345191 |
# define JEMALLOC_NO_DEMANGLE
|
|
Packit |
345191 |
# endif
|
|
Packit |
345191 |
EOF
|
|
Packit |
345191 |
|
|
Packit |
345191 |
for nm in `cat ${public_symbols_txt}` ; do
|
|
Packit |
345191 |
n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
|
|
Packit |
345191 |
echo "# define ${n} ${symbol_prefix}${n}"
|
|
Packit |
345191 |
done
|
|
Packit |
345191 |
|
|
Packit |
345191 |
cat <
|
|
Packit |
345191 |
#endif
|
|
Packit |
345191 |
|
|
Packit |
345191 |
/*
|
|
Packit |
345191 |
* The ${symbol_prefix}* macros can be used as stable alternative names for the
|
|
Packit |
345191 |
* public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
|
|
Packit |
345191 |
* meant for use in jemalloc itself, but it can be used by application code to
|
|
Packit |
345191 |
* provide isolation from the name mangling specified via --with-mangling
|
|
Packit |
345191 |
* and/or --with-jemalloc-prefix.
|
|
Packit |
345191 |
*/
|
|
Packit |
345191 |
#ifndef JEMALLOC_NO_DEMANGLE
|
|
Packit |
345191 |
EOF
|
|
Packit |
345191 |
|
|
Packit |
345191 |
for nm in `cat ${public_symbols_txt}` ; do
|
|
Packit |
345191 |
n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
|
|
Packit |
345191 |
echo "# undef ${symbol_prefix}${n}"
|
|
Packit |
345191 |
done
|
|
Packit |
345191 |
|
|
Packit |
345191 |
cat <
|
|
Packit |
345191 |
#endif
|
|
Packit |
345191 |
EOF
|