android_kernel_samsung_a7y1.../scripts
Paul Walmsley 9b8e776d68 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 2e3a10a1551d ("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>
2020-04-07 12:45:17 +02:00
..
basic A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2020-04-06 18:47:45 +02:00
dtbtool_exynos Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
dtc A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fmp A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gdb scripts/gdb: fix debugging modules compiled with hot/cold partitioning 2020-04-07 12:40:58 +02:00
genksyms A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kconfig kconfig/[mn]conf: handle backspace (^H) key 2020-04-06 16:41:44 +02:00
ksymoops A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mod modpost: skip ELF local symbols during section mismatch check 2020-04-07 12:45:17 +02:00
package A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
selinux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tracing A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
analyze_suspend.py A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
android-major-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
android-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
asn1_compiler.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bloat-o-meter A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
bootgraph.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check_extable.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
check-lc_ctype.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkincludes.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkkconfigsymbols.py A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkpatch.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2020-04-06 19:16:34 +02:00
checksyscalls.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
checkversion.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
clang-android.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cleanfile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cleanpatch A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
coccicheck A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
config A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
conmakehash.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
decode_stacktrace.sh scripts/decode_stacktrace: match basepath using shell prefix operator, not regex 2020-04-06 21:34:57 +02:00
decodecode A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
depmod.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
diffconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
docproc.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
export_report.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-cert.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-ikconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-module-sig.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-sys-certs.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extract-vmlinux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_matching_major.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
find_matching_version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_fmp_hmac.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_fmp_utils.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fips_kaslr_fmp_hmac.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-goto.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-ld A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-x86_32-has-stack-protector.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gcc-x86_64-has-stack-protector.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gen_initramfs_list.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
get_dvb_firmware A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
get_maintainer.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
gfp-translate A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headerdep.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers_check.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers_install.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
headers.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kallsyms.c kallsyms: exclude kasan local symbols on s390 2020-04-06 20:06:26 +02:00
kaslr_fips_fmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kaslr_patch.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kbuild.include kbuild: simplify ld-option implementation 2020-04-06 16:38:00 +02:00
kernel-doc A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
kernel-doc-xml-ref A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ld-version.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Lindent A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
link-vmlinux.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
Makefile.asm-generic A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.build A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.clean A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.dtbinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.extrawarn A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.fwinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.headersinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.help A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.host A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.kasan A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.lib Introduce Exynos dtbtool to the Linux build system 2020-03-27 22:20:07 +05:30
Makefile.modbuiltin A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.modinst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile.modpost kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules 2020-04-06 20:49:10 +02:00
Makefile.modsign A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
makelst A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
markup_oops.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkcompile_h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkmakefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mksysmap A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkuboot.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mkversion A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
module-common.lds A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
namespace.pl namespace: fix namespace.pl script to support relative paths 2020-04-07 09:24:14 +02:00
objdiff A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
patch-kernel A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
pnmtologo.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
profile2linkerlist.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
recordmcount.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2020-04-06 20:06:14 +02:00
recordmcount.pl A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
replace_dir.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
setlocalversion scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks 2020-04-07 09:27:28 +02:00
show_delta A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sign-file.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sortextable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sortextable.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
spelling.txt A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackdelta A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
stackusage A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tags.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
unifdef.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ver_linux A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xen-hypercalls.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xz_wrap.sh A750FXXU4CTBC 2020-03-27 21:51:54 +05:30