From d210b92a165277eeb15f5d14254e94e0ce113765 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 9 Dec 2025 17:03:16 -0600 Subject: [PATCH 1/3] linuxkm/Makefile: tweak GENERATE_SECTION_MAP recipe to expect --sections output from readelf, and feed that to it, to work around missing section names in --symbols output on binutils <2.36. --- linuxkm/Makefile | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/linuxkm/Makefile b/linuxkm/Makefile index 4cd05cf96..4e48291de 100644 --- a/linuxkm/Makefile +++ b/linuxkm/Makefile @@ -104,21 +104,41 @@ ifndef MAKE_TMPDIR endif GENERATE_SECTION_MAP := $(AWK) 'BEGIN { printf("") >ENVIRON["SECTION_MAP"]; } \ - { \ - if ($$7 !~ "^[0-9]+$$") \ - next; \ - if ($$4 == "SECTION") { \ - sections[$$7] = $$8; \ - next; \ + /^Section Headers:/ { \ + in_sections = 1; \ + in_symbols = 0; \ + next; \ + } \ + /^Symbol table / { \ + if (! in_sections) { \ + print "symbol table appeared before section headers." >"/dev/stderr"; \ + exit(1); \ } \ - if (($$4 == "NOTYPE") || ($$4 == "OBJECT") || ($$4 == "FUNC")) { \ - if (($$8 == "$$d") || ($$8 == "$$t")) \ + in_sections = 0; \ + in_symbols = 1; \ + next; \ + } \ + { \ + if (in_sections) { \ + if (match($$0, \ + "^[[:space:]]*\\[[[:space:]]*([0-9]+)[[:space:]]*\\][[:space:]]+([^[:space:]]+)[[:space:]]",\ + section_line_a)) { \ + sections[section_line_a[1]] = section_line_a[2]; \ next; \ - if ($$7 in sections) { \ - if (sections[$$7] ~ "_wolfcrypt$$") \ - print $$8 "\t" sections[$$7] >>ENVIRON["SECTION_MAP"]; \ - } else \ - print $$8 " is in section " $$7 " with no name mapping." >"/dev/stderr";\ + } \ + } \ + if (in_symbols) { \ + if ($$7 !~ "^[0-9]+$$") \ + next; \ + if (($$4 == "NOTYPE") || ($$4 == "OBJECT") || ($$4 == "FUNC")) { \ + if (($$8 == "$$d") || ($$8 == "$$t")) \ + next; \ + if ($$7 in sections) { \ + if (sections[$$7] ~ "_wolfcrypt$$") \ + print $$8 "\t" sections[$$7] >>ENVIRON["SECTION_MAP"]; \ + } else \ + print $$8 " is in section " $$7 " with no name mapping." >"/dev/stderr";\ + } \ } \ }' @@ -272,7 +292,7 @@ ifeq "$(ENABLED_LINUXKM_PIE)" "yes" @SECTION_MAP=$$(mktemp) @trap 'rm "$$SECTION_MAP"' EXIT @export SECTION_MAP - @$(READELF) --wide --symbols "$@" | $(GENERATE_SECTION_MAP) + @$(READELF) --wide --sections --symbols "$@" | $(GENERATE_SECTION_MAP) @$(READELF) --wide --relocs "$@" | $(GENERATE_RELOC_TAB) >| '$(MODULE_TOP)/linuxkm/wc_linuxkm_pie_reloc_tab.c' +$(MAKE) ARCH='$(KERNEL_ARCH)' $(OVERRIDE_PATHS) $(CROSS_COMPILE) -C '$(KERNEL_ROOT)' M='$(MODULE_TOP)' $(KBUILD_EXTRA_FLAGS) CC_FLAGS_FTRACE= @$(READELF) --wide --relocs "$@" | $(GENERATE_RELOC_TAB) >| "$$RELOC_TMP" From 41b2fc28b3658e9c25af466e56793c6a505b9f43 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Tue, 9 Dec 2025 17:15:48 -0600 Subject: [PATCH 2/3] wolfssl/wolfcrypt/wc_port.h: add WC_DEPRECATED() definitions for _MSC_VER < 1400. --- wolfssl/wolfcrypt/wc_port.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 513ba98ff..d92533a91 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -95,9 +95,15 @@ #elif defined(__WATCOMC__) /* Watcom macro needs to expand to something, here just a comment: */ #define WC_DEPRECATED(msg) /* null expansion */ - #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \ - defined(_WIN32_WCE) + #elif (defined(_MSC_VER) && _MSC_VER >= 1400) || defined(__MINGW32__) || \ + defined(__CYGWIN__) || defined(_WIN32_WCE) #define WC_DEPRECATED(msg) __declspec(deprecated(msg)) + #elif defined(_MSC_VER) + #ifdef __cplusplus + #define WC_DEPRECATED(msg) __declspec(deprecated) + #else + #define WC_DEPRECATED(msg) __pragma(deprecated) + #endif #elif (defined(__GNUC__) && (__GNUC__ >= 4)) || \ defined(__IAR_SYSTEMS_ICC__) #define WC_DEPRECATED(msg) __attribute__((deprecated)) From ba861971eb9b6be45829db2274ac4f854b822b02 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 10 Dec 2025 11:15:55 -0600 Subject: [PATCH 3/3] wolfssl/wolfcrypt/wc_port.h: don't attempt to define WC_DEPRECATED() for _MSC_VER < 1400 -- still causing error on old MSVC (now C2085 rather than C2485). --- wolfssl/wolfcrypt/wc_port.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index d92533a91..e8fbc52b6 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -98,12 +98,6 @@ #elif (defined(_MSC_VER) && _MSC_VER >= 1400) || defined(__MINGW32__) || \ defined(__CYGWIN__) || defined(_WIN32_WCE) #define WC_DEPRECATED(msg) __declspec(deprecated(msg)) - #elif defined(_MSC_VER) - #ifdef __cplusplus - #define WC_DEPRECATED(msg) __declspec(deprecated) - #else - #define WC_DEPRECATED(msg) __pragma(deprecated) - #endif #elif (defined(__GNUC__) && (__GNUC__ >= 4)) || \ defined(__IAR_SYSTEMS_ICC__) #define WC_DEPRECATED(msg) __attribute__((deprecated))