Thread (34 messages) 34 messages, 5 authors, 2022-05-12

Re: [PATCH v4 10/14] kbuild: check static EXPORT_SYMBOL* by script instead of modpost

From: Nick Desaulniers <hidden>
Date: 2022-05-09 18:06:02
Also in: linux-kbuild, linux-modules, linux-s390, lkml

On Sun, May 8, 2022 at 12:10 PM Masahiro Yamada [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/scripts/check-local-export b/scripts/check-local-export
new file mode 100755
index 000000000000..d1721fa63057
--- /dev/null
+++ b/scripts/check-local-export
@@ -0,0 +1,48 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2022 Masahiro Yamada
+
+set -e
+set -o pipefail
+
+declare -A symbol_types
+declare -a export_symbols
+
+exit_code=0
+
+while read value type name
+do
+       # to avoid error for clang LTO; $name may be empty
+       if [[ $value = -* && -z $name ]]; then
+               continue
+       fi
+
+       # The first field (value) may be empty. If so, fix it up.
+       if [[ -z $name ]]; then
+          name=${type}
+          type=${value}
+       fi
Consider adding examples of output from NM as comments where you're
handling special cases.

Aren't BOTH from LTO?  The first case is:

---------------- T strncpy

while the second is

                 U strncpy

IIUC?

Reviewed-by: Nick Desaulniers <redacted>
-- 
Thanks,
~Nick Desaulniers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help