Skip to content

Commit 1faf740

Browse files
authored
Merge pull request #9505 from douzzer/20251209-linuxkm-GENERATE_SECTION_MAP--sections
20251209-linuxkm-GENERATE_SECTION_MAP--sections
2 parents 4d4751b + ba86197 commit 1faf740

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

linuxkm/Makefile

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,41 @@ ifndef MAKE_TMPDIR
104104
endif
105105

106106
GENERATE_SECTION_MAP := $(AWK) 'BEGIN { printf("") >ENVIRON["SECTION_MAP"]; } \
107+
/^Section Headers:/ { \
108+
in_sections = 1; \
109+
in_symbols = 0; \
110+
next; \
111+
} \
112+
/^Symbol table / { \
113+
if (! in_sections) { \
114+
print "symbol table appeared before section headers." >"/dev/stderr"; \
115+
exit(1); \
116+
} \
117+
in_sections = 0; \
118+
in_symbols = 1; \
119+
next; \
120+
} \
107121
{ \
108-
if ($$7 !~ "^[0-9]+$$") \
109-
next; \
110-
if ($$4 == "SECTION") { \
111-
sections[$$7] = $$8; \
112-
next; \
122+
if (in_sections) { \
123+
if (match($$0, \
124+
"^[[:space:]]*\\[[[:space:]]*([0-9]+)[[:space:]]*\\][[:space:]]+([^[:space:]]+)[[:space:]]",\
125+
section_line_a)) { \
126+
sections[section_line_a[1]] = section_line_a[2]; \
127+
next; \
128+
} \
113129
} \
114-
if (($$4 == "NOTYPE") || ($$4 == "OBJECT") || ($$4 == "FUNC")) { \
115-
if (($$8 == "$$d") || ($$8 == "$$t")) \
130+
if (in_symbols) { \
131+
if ($$7 !~ "^[0-9]+$$") \
116132
next; \
117-
if ($$7 in sections) { \
118-
if (sections[$$7] ~ "_wolfcrypt$$") \
119-
print $$8 "\t" sections[$$7] >>ENVIRON["SECTION_MAP"]; \
120-
} else \
121-
print $$8 " is in section " $$7 " with no name mapping." >"/dev/stderr";\
133+
if (($$4 == "NOTYPE") || ($$4 == "OBJECT") || ($$4 == "FUNC")) { \
134+
if (($$8 == "$$d") || ($$8 == "$$t")) \
135+
next; \
136+
if ($$7 in sections) { \
137+
if (sections[$$7] ~ "_wolfcrypt$$") \
138+
print $$8 "\t" sections[$$7] >>ENVIRON["SECTION_MAP"]; \
139+
} else \
140+
print $$8 " is in section " $$7 " with no name mapping." >"/dev/stderr";\
141+
} \
122142
} \
123143
}'
124144

@@ -272,7 +292,7 @@ ifeq "$(ENABLED_LINUXKM_PIE)" "yes"
272292
@SECTION_MAP=$$(mktemp)
273293
@trap 'rm "$$SECTION_MAP"' EXIT
274294
@export SECTION_MAP
275-
@$(READELF) --wide --symbols "$@" | $(GENERATE_SECTION_MAP)
295+
@$(READELF) --wide --sections --symbols "$@" | $(GENERATE_SECTION_MAP)
276296
@$(READELF) --wide --relocs "$@" | $(GENERATE_RELOC_TAB) >| '$(MODULE_TOP)/linuxkm/wc_linuxkm_pie_reloc_tab.c'
277297
+$(MAKE) ARCH='$(KERNEL_ARCH)' $(OVERRIDE_PATHS) $(CROSS_COMPILE) -C '$(KERNEL_ROOT)' M='$(MODULE_TOP)' $(KBUILD_EXTRA_FLAGS) CC_FLAGS_FTRACE=
278298
@$(READELF) --wide --relocs "$@" | $(GENERATE_RELOC_TAB) >| "$$RELOC_TMP"

wolfssl/wolfcrypt/wc_port.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
#elif defined(__WATCOMC__)
9696
/* Watcom macro needs to expand to something, here just a comment: */
9797
#define WC_DEPRECATED(msg) /* null expansion */
98-
#elif defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
99-
defined(_WIN32_WCE)
98+
#elif (defined(_MSC_VER) && _MSC_VER >= 1400) || defined(__MINGW32__) || \
99+
defined(__CYGWIN__) || defined(_WIN32_WCE)
100100
#define WC_DEPRECATED(msg) __declspec(deprecated(msg))
101101
#elif (defined(__GNUC__) && (__GNUC__ >= 4)) || \
102102
defined(__IAR_SYSTEMS_ICC__)

0 commit comments

Comments
 (0)