Paul Walmsley
f28d930810
modpost: skip ELF local symbols during section mismatch check
...
[ Upstream commit a4d26f1a0958bb1c2b60c6f1e67c6f5d43e2647b ]
During development of a serial console driver with a gcc 8.2.0
toolchain for RISC-V, the following modpost warning appeared:
----
WARNING: vmlinux.o(.data+0x19b10): Section mismatch in reference from the variable .LANCHOR1 to the function .init.text:sifive_serial_console_setup()
The variable .LANCHOR1 references
the function __init sifive_serial_console_setup()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
----
".LANCHOR1" is an ELF local symbol, automatically created by gcc's section
anchor generation code:
https://gcc.gnu.org/onlinedocs/gccint/Anchored-Addresses.html
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/varasm.c;h=cd9591a45617464946dcf9a126dde277d9de9804;hb=9fb89fa845c1b2e0a18d85ada0b077c84508ab78#l7473
This was verified by compiling the kernel with -fno-section-anchors
and observing that the ".LANCHOR1" ELF local symbol disappeared, and
modpost no longer warned about the section mismatch. The serial
driver code idiom triggering the warning is standard Linux serial
driver practice that has a specific whitelist inclusion in modpost.c.
I'm neither a modpost nor an ELF expert, but naively, it doesn't seem
useful for modpost to report section mismatch warnings caused by ELF
local symbols by default. Local symbols have compiler-generated
names, and thus bypass modpost's whitelisting algorithm, which relies
on the presence of a non-autogenerated symbol name. This increases
the likelihood that false positive warnings will be generated (as in
the above case).
Thus, disable section mismatch reporting on ELF local symbols. The
rationale here is similar to that of commit 2e3a10a155 ("ARM: avoid
ARM binutils leaking ELF local symbols") and of similar code already
present in modpost.c:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/mod/modpost.c?h=v4.19-rc4&id=7876320f88802b22d4e2daf7eb027dd14175a0f8#n1256
This third version of the patch implements a suggestion from Masahiro
Yamada <yamada.masahiro@socionext.com> to restructure the code as an
additional pattern matching step inside secref_whitelist(), and
further improves the patch description.
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-13 08:52:20 +01:00
..
basic
kbuild: move bin2c back to scripts/ from scripts/basic/
2018-07-18 01:18:05 +09:00
coccinelle
fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock
2019-05-08 07:21:51 +02:00
dtc
scripts/dtc: consolidate include path options in Makefile
2018-08-22 23:21:36 +09:00
gcc-plugins
randstruct: Check member structs in is_pure_ops_struct()
2019-10-05 13:10:02 +02:00
gdb
scripts/gdb: fix debugging modules compiled with hot/cold partitioning
2019-12-05 09:19:44 +01:00
genksyms
genksyms: Teach parser about 128-bit built-in types
2019-07-31 07:27:02 +02:00
kconfig
kconfig: Clear "written" flag to avoid data loss
2019-08-06 19:06:53 +02:00
ksymoops
Fix dead URLs to ftp.kernel.org
2017-03-28 16:16:52 +02:00
mod
modpost: skip ELF local symbols during section mismatch check
2019-12-13 08:52:20 +01:00
package
kbuild: deb-pkg: fix bindeb-pkg breakage when O= is used
2019-04-17 08:38:45 +02:00
selinux
selinux: use kernel linux/socket.h for genheaders and mdp
2019-05-04 09:20:10 +02:00
tracing
scripts: Add Python 3 support to tracing/draw_functrace.py
2018-07-29 11:08:38 +09:00
.gitignore
kbuild: move bin2c back to scripts/ from scripts/basic/
2018-07-18 01:18:05 +09:00
adjust_autoksyms.sh
kbuild: remove CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
2018-05-17 22:44:57 +09:00
asn1_compiler.c
kbuild: rename *-asn1.[ch] to *.asn1.[ch]
2018-04-07 19:04:02 +09:00
bin2c.c
kbuild: move bin2c back to scripts/ from scripts/basic/
2018-07-18 01:18:05 +09:00
bloat-o-meter
syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
2018-04-09 16:47:28 +02:00
bootgraph.pl
scripts: Switch to more portable Perl shebang
2017-05-14 11:20:44 +09:00
bpf_helpers_doc.py
bpf: change eBPF helper doc parsing script to allow for smaller indent
2018-05-17 17:34:43 +02:00
cc-can-link.sh
bpfilter: check compiler capability in Kconfig
2018-06-28 13:36:39 +09:00
check_00index.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
check_extable.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
checkincludes.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
checkkconfigsymbols.py
checkkconfigsymbols.py: support Kconfig's 'imply' statement
2017-02-03 11:49:06 +01:00
checkpatch.pl
checkpatch: add __ro_after_init to known $Attribute
2018-09-04 16:45:02 -07:00
checkstack.pl
scripts/checkstack.pl: Fix arm64 wrong or unknown architecture
2019-06-25 11:35:58 +08:00
checksyscalls.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
checkversion.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
clang-version.sh
kbuild: Add a space after ! to prevent parsing as file pattern
2018-08-22 23:21:40 +09:00
cleanfile
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
cleanpatch
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
coccicheck
coccicheck: return proper error code on fail
2018-08-14 08:58:56 +09:00
config
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
conmakehash.c
const_structs.checkpatch
const_structs.checkpatch: add frequently used from Julia Lawall's list
2016-10-11 15:06:30 -07:00
decode_stacktrace.sh
scripts/decode_stacktrace: match basepath using shell prefix operator, not regex
2019-09-16 08:21:44 +02:00
decodecode
scripts/decodecode: make it take multiline Code line
2018-01-31 17:18:34 -08:00
depmod.sh
kbuild: modules_install: warn when missing System.map file
2018-09-09 09:14:07 +09:00
diffconfig
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
documentation-file-ref-check
scripts/documentation-file-ref-check: ignore sched-pelt false positive
2018-07-02 11:25:00 -06:00
export_report.pl
scripts: Switch to more portable Perl shebang
2017-05-14 11:20:44 +09:00
extract-cert.c
extract-ikconfig
extract-module-sig.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
extract-sys-certs.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
extract-vmlinux
scripts: teach extract-vmlinux about LZ4 and ZSTD
2018-07-08 09:32:32 +09:00
extract_xc3028.pl
MAINTAINERS & files: Canonize the e-mails I use at files
2018-05-04 06:21:06 -04:00
faddr2line
scripts/faddr2line: make the new code listing format optional
2018-06-05 09:04:37 -07:00
file-size.sh
kbuild: Use ls(1) instead of stat(1) to obtain file size
2018-03-26 02:01:24 +09:00
find-unused-docs.sh
scripts: Add a script to find unused documentation
2017-10-23 08:01:37 -06:00
gcc-goto.sh
jump_label: move 'asm goto' support test to Kconfig
2019-06-04 08:02:34 +02:00
gcc-ld
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
gcc-plugin.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
gcc-version.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
gcc-x86_32-has-stack-protector.sh
stack-protector: test compiler capability in Kconfig and drop AUTO mode
2018-06-08 18:56:00 +09:00
gcc-x86_64-has-stack-protector.sh
stack-protector: Fix test with 32-bit userland and CONFIG_64BIT=y
2018-06-25 23:21:13 +09:00
get_dvb_firmware
scripts: Switch to more portable Perl shebang
2017-05-14 11:20:44 +09:00
get_maintainer.pl
get_maintainer: allow option --mpath <directory> to read all files in <directory>
2018-08-22 10:52:48 -07:00
gfp-translate
headerdep.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
headers.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
headers_check.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
headers_install.sh
kbuild: Improve portability of some sed invocations
2018-03-26 02:01:18 +09:00
insert-sys-cert.c
KEYS: Reserve an extra certificate symbol for inserting without recompiling
2016-02-26 15:30:20 +00:00
kallsyms.c
kallsyms: exclude kasan local symbols on s390
2019-07-31 07:27:05 +02:00
Kbuild.include
x86/build: Remove jump label quirk for GCC older than 4.5.2
2018-08-30 11:37:08 +02:00
Kconfig.include
kbuild: Check for unknown options with cc-option usage in Kconfig and clang
2019-08-25 10:47:56 +02:00
kernel-doc
scripts/kernel-doc: Escape all literal braces in regexes
2018-08-06 13:36:20 -06:00
ld-version.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
leaking_addresses.pl
leaking_addresses: check if file name contains address
2018-04-07 08:50:34 +10:00
Lindent
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
link-vmlinux.sh
kbuild: rename LDFLAGS to KBUILD_LDFLAGS
2018-08-24 08:22:08 +09:00
Makefile
kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
2018-07-18 01:18:05 +09:00
Makefile.asm-generic
Kbuild updates for v4.15
2017-11-17 17:45:29 -08:00
Makefile.build
x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support
2018-12-05 19:32:01 +01:00
Makefile.clean
kbuild: remove deprecated host-progs variable
2018-08-09 21:51:17 +09:00
Makefile.dtbinst
DeviceTree for 4.15:
2017-11-14 18:25:40 -08:00
Makefile.extrawarn
Kbuild: suppress packed-not-aligned warning for default setting only
2018-01-18 09:37:53 +09:00
Makefile.gcc-plugins
gcc-plugins: Regularize Makefile.gcc-plugins
2018-07-24 16:11:07 -07:00
Makefile.headersinst
Kbuild updates for v4.15
2017-11-17 17:45:29 -08:00
Makefile.host
kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS
2018-07-18 01:18:05 +09:00
Makefile.kasan
kasan: rework Kconfig settings
2018-02-06 18:32:47 -08:00
Makefile.kcov
kcov: test compiler capability in Kconfig and correct dependency
2018-06-11 09:14:08 +09:00
Makefile.lib
kbuild: disable dtc simple_bus_reg warnings by default
2019-12-13 08:52:18 +01:00
Makefile.modbuiltin
Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory
2018-08-03 00:47:00 +09:00
Makefile.modinst
kbuild: remove duplicated comments about PHONY
2018-07-06 22:04:03 +09:00
Makefile.modpost
kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules
2019-08-25 10:47:55 +02:00
Makefile.modsign
kbuild: remove duplicated comments about PHONY
2018-07-06 22:04:03 +09:00
Makefile.ubsan
lib/ubsan: remove null-pointer checks
2018-08-10 20:19:58 -07:00
makelst
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
markup_oops.pl
scripts: Switch to more portable Perl shebang
2017-05-14 11:20:44 +09:00
mkcompile_h
Kbuild updates for v4.15
2017-11-17 17:45:29 -08:00
mkmakefile
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
mksysmap
mkuboot.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
module-common.lds
module: set .init_array alignment to 8
2017-03-13 09:40:28 -07:00
namespace.pl
namespace: fix namespace.pl script to support relative paths
2019-10-29 09:19:36 +01:00
objdiff
scripts: objdiff: Ignore debug info when comparing
2017-03-11 11:13:38 +09:00
parse-maintainers.pl
parse-maintainers: add ability to specify filenames
2017-11-17 16:10:01 -08:00
patch-kernel
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
pnmtologo.c
profile2linkerlist.pl
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
prune-kernel
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
recordmcount.c
scripts: Fixed printf format mismatch
2018-05-29 22:04:12 +09:00
recordmcount.h
recordmcount: Fix spurious mcount entries on powerpc
2019-07-31 07:27:03 +02:00
recordmcount.pl
nds32/ftrace: Add RECORD_MCOUNT support
2018-09-04 14:45:18 +08:00
setlocalversion
scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
2019-11-06 13:05:27 +01:00
show_delta
sign-file.c
sign-file: fix build error in sign-file.c with libressl
2017-02-10 12:43:47 +11:00
sortextable.c
powerpc: Build-time sort the exception table
2016-11-14 11:11:51 +11:00
sortextable.h
spdxcheck.py
scripts/spdxcheck.py: always open files in binary mode
2018-12-19 19:19:50 +01:00
spelling.txt
treewide: correct "differenciate" and "instanciate" typos
2018-08-23 18:48:43 -07:00
sphinx-pre-install
scripts/sphinx-pre-install: fix script for RHEL/CentOS
2019-08-16 10:12:44 +02:00
split-man.pl
MAINTAINERS & files: Canonize the e-mails I use at files
2018-05-04 06:21:06 -04:00
stackdelta
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
stackusage
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
subarch.include
selftests: add headers_install to lib.mk
2018-09-05 08:12:09 -06:00
tags.sh
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2018-07-18 19:32:54 -07:00
unifdef.c
unifdef: use memcpy instead of strncpy
2018-12-08 12:59:06 +01:00
ver_linux
ver_linux: Do not check for ver_linux pattern in version function
2018-07-07 17:44:52 +02:00
xen-hypercalls.sh
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
xz_wrap.sh