forked from wolfSSL/wolfssl
Merge pull request #8492 from douzzer/20250221-fix-Kbuild-EXPORT_SYMBOL_NS_GPL
20250221-fix-Kbuild-EXPORT_SYMBOL_NS_GPL
This commit is contained in:
@ -138,8 +138,8 @@ CONFIG_WOLFSSL_TARGET_PORT
|
||||
CONFIG_WOLFSSL_TLS13_ENABLED
|
||||
CONFIG_WOLFSSL_TLS_VERSION_1_2
|
||||
CONFIG_WOLFSSL_TLS_VERSION_1_3
|
||||
CONFIG_WOLFTPM_EXAMPLE_NAME_ESPRESSIF
|
||||
CONFIG_WOLFTPM
|
||||
CONFIG_WOLFTPM_EXAMPLE_NAME_ESPRESSIF
|
||||
CONFIG_X86
|
||||
CONV_WITH_DIV
|
||||
CPA_CY_API_VERSION_NUM_MAJOR
|
||||
@ -619,7 +619,6 @@ WOLFSSL_DILITHIUM_VERIFY_NO_MALLOC
|
||||
WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM
|
||||
WOLFSSL_DISABLE_EARLY_SANITY_CHECKS
|
||||
WOLFSSL_DTLS_DISALLOW_FUTURE
|
||||
WOLFSSL_DTLS_DROP_STATS
|
||||
WOLFSSL_DTLS_RESEND_ONLY_TIMEOUT
|
||||
WOLFSSL_DUMP_MEMIO_STREAM
|
||||
WOLFSSL_DUP_CERTPOL
|
||||
@ -802,7 +801,6 @@ WOLFSSL_TLS13_MIDDLEBOX_COMPAT
|
||||
WOLFSSL_TLS13_SHA512
|
||||
WOLFSSL_TLS13_TICKET_BEFORE_FINISHED
|
||||
WOLFSSL_TLSX_PQC_MLKEM_STORE_PRIV_KEY
|
||||
WOLFSSL_TLSX_PQC_MLKEM_STORE_OBJ
|
||||
WOLFSSL_TRACK_MEMORY_FULL
|
||||
WOLFSSL_TRAP_MALLOC_SZ
|
||||
WOLFSSL_UNALIGNED_64BIT_ACCESS
|
||||
@ -918,8 +916,8 @@ __MINGW64_VERSION_MAJOR
|
||||
__MINGW64__
|
||||
__MWERKS__
|
||||
__NT__
|
||||
__OpenBSD__
|
||||
__OS2__
|
||||
__OpenBSD__
|
||||
__PIE__
|
||||
__POWERPC__
|
||||
__PPC__
|
||||
|
@ -18,6 +18,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
|
||||
.ONESHELL:
|
||||
SHELL=bash
|
||||
|
||||
ifeq "$(WOLFSSL_OBJ_FILES)" ""
|
||||
@ -158,30 +159,30 @@ rename-pie-text-and-data-sections:
|
||||
ifneq "$(quiet)" "silent_"
|
||||
@echo -n ' Checking wolfCrypt for unresolved symbols and forbidden relocations... '
|
||||
endif
|
||||
@cd "$(obj)" || exit $$?; \
|
||||
$(LD) -relocatable -o wolfcrypt_test_link.o $(WOLFCRYPT_PIE_FILES) || exit $$?; \
|
||||
undefined=$$($(NM) --undefined-only wolfcrypt_test_link.o) || exit $$?; \
|
||||
GOT_relocs=$$($(READELF) --relocs --wide wolfcrypt_test_link.o | egrep '^[^ ]+ +[^ ]+ +[^ ]*GOT[^ ]* ') || [ $$? = 1 ] || exit 2; \
|
||||
rm wolfcrypt_test_link.o; \
|
||||
if [ -n "$$undefined" ]; then \
|
||||
echo "wolfCrypt container has unresolved symbols:" 1>&2; \
|
||||
echo "$$undefined" 1>&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ -n "$$GOT_relocs" ]; then \
|
||||
echo "wolfCrypt container has GOT relocations (non-local function address used as operand?):" 1>&2; \
|
||||
echo "$$GOT_relocs" 1>&2; \
|
||||
exit 1; \
|
||||
@cd "$(obj)" || exit $$?
|
||||
$(LD) -relocatable -o wolfcrypt_test_link.o $(WOLFCRYPT_PIE_FILES) || exit $$?
|
||||
undefined=$$($(NM) --undefined-only wolfcrypt_test_link.o) || exit $$?
|
||||
GOT_relocs=$$($(READELF) --relocs --wide wolfcrypt_test_link.o | egrep '^[^ ]+ +[^ ]+ +[^ ]*GOT[^ ]* ') || [ $$? = 1 ] || exit 2
|
||||
rm wolfcrypt_test_link.o
|
||||
if [ -n "$$undefined" ]; then
|
||||
echo "wolfCrypt container has unresolved symbols:" 1>&2
|
||||
echo "$$undefined" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$$GOT_relocs" ]; then
|
||||
echo "wolfCrypt container has GOT relocations (non-local function address used as operand?):" 1>&2
|
||||
echo "$$GOT_relocs" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
ifneq "$(quiet)" "silent_"
|
||||
@echo 'OK.'
|
||||
echo 'OK.'
|
||||
endif
|
||||
@cd "$(obj)" || exit $$?; \
|
||||
for file in $(WOLFCRYPT_PIE_FILES); do \
|
||||
$(OBJCOPY) --rename-section .text=.text.wolfcrypt --rename-section .data=.data.wolfcrypt --rename-section .rodata=.rodata.wolfcrypt "$$file" || exit $$?; \
|
||||
cd "$(obj)" || exit $$?
|
||||
for file in $(WOLFCRYPT_PIE_FILES); do
|
||||
$(OBJCOPY) --rename-section .text=.text.wolfcrypt --rename-section .data=.data.wolfcrypt --rename-section .rodata=.rodata.wolfcrypt "$$file" || exit $$?
|
||||
done
|
||||
ifneq "$(quiet)" "silent_"
|
||||
@echo ' wolfCrypt .{text,data,rodata} sections containerized to .{text,data,rodata}.wolfcrypt'
|
||||
echo ' wolfCrypt .{text,data,rodata} sections containerized to .{text,data,rodata}.wolfcrypt'
|
||||
endif
|
||||
|
||||
$(obj)/linuxkm/module_exports.c: rename-pie-text-and-data-sections
|
||||
@ -192,14 +193,20 @@ endif
|
||||
# auto-generate the exported symbol list, leveraging the WOLFSSL_API visibility tags.
|
||||
# exclude symbols that don't match wc_* or wolf*.
|
||||
$(obj)/linuxkm/module_exports.c: $(src)/module_exports.c.template $(WOLFSSL_OBJ_TARGETS)
|
||||
@cp $< $@
|
||||
@$(READELF) --symbols --wide $(WOLFSSL_OBJ_TARGETS) | \
|
||||
$(AWK) '/^ *[0-9]+: / { \
|
||||
if ($$8 !~ /^(wc_|wolf|WOLF|TLSX_)/){next;} \
|
||||
if (($$4 == "FUNC") && ($$5 == "GLOBAL") && ($$6 == "DEFAULT")) { \
|
||||
print "EXPORT_SYMBOL_NS_GPL(" $$8 ", EXPORT_SYMBOL_NS_Q(WOLFSSL));";\
|
||||
} \
|
||||
}' >> $@
|
||||
@echo -e '#ifndef NO_CRYPT_TEST\nEXPORT_SYMBOL_NS_GPL(wolfcrypt_test, EXPORT_SYMBOL_NS_Q(WOLFSSL));\n#endif' >> $@
|
||||
@cp $< $@ || exit $$?
|
||||
if [[ "$${VERSION}" -gt 6 || ("$${VERSION}" -eq 6 && "$${PATCHLEVEL}" -ge 13) ]]; then
|
||||
# use ASCII octal escape to avoid syntax disruption in the awk script.
|
||||
ns='\042WOLFSSL\042'
|
||||
else
|
||||
ns='WOLFSSL'
|
||||
fi
|
||||
$(READELF) --symbols --wide $(WOLFSSL_OBJ_TARGETS) |
|
||||
$(AWK) '/^ *[0-9]+: / {
|
||||
if ($$8 !~ /^(wc_|wolf|WOLF|TLSX_)/){next;}
|
||||
if (($$4 == "FUNC") && ($$5 == "GLOBAL") && ($$6 == "DEFAULT")) {
|
||||
print "EXPORT_SYMBOL_NS_GPL(" $$8 ", '"$$ns"');";
|
||||
}
|
||||
}' >> $@ || exit $$?
|
||||
echo -e "#ifndef NO_CRYPT_TEST\nEXPORT_SYMBOL_NS_GPL(wolfcrypt_test, $${ns});\n#endif" >> $@
|
||||
|
||||
clean-files := linuxkm src wolfcrypt
|
||||
|
@ -47,12 +47,6 @@
|
||||
#define EXPORT_SYMBOL_NS_GPL(sym, ns) EXPORT_SYMBOL_GPL(sym)
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
|
||||
#define EXPORT_SYMBOL_NS_Q(x) #x
|
||||
#else
|
||||
#define EXPORT_SYMBOL_NS_Q(x) x
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/memory.h>
|
||||
#include <wolfssl/wolfcrypt/wc_port.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
@ -3620,6 +3620,22 @@ extern void uITRON4_free(void *p) ;
|
||||
#ifdef __PIE__
|
||||
#define WC_NO_INTERNAL_FUNCTION_POINTERS
|
||||
#endif
|
||||
|
||||
#ifndef NO_OLD_WC_NAMES
|
||||
#define NO_OLD_WC_NAMES
|
||||
#endif
|
||||
#ifndef NO_OLD_SHA_NAMES
|
||||
#define NO_OLD_SHA_NAMES
|
||||
#endif
|
||||
#ifndef NO_OLD_MD5_NAME
|
||||
#define NO_OLD_MD5_NAME
|
||||
#endif
|
||||
#ifndef OPENSSL_COEXIST
|
||||
#define OPENSSL_COEXIST
|
||||
#endif
|
||||
#ifndef NO_OLD_SSL_NAMES
|
||||
#define NO_OLD_SSL_NAMES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user