The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)
Перейти к файлу
Masahiro Yamada 31cb50b559 kbuild: check static EXPORT_SYMBOL* by script instead of modpost
The 'static' specifier and EXPORT_SYMBOL() are an odd combination.

Commit 15bfc2348d ("modpost: check for static EXPORT_SYMBOL*
functions") tried to detect it, but this check has false negatives.

Here is the sample code.

  Makefile:

    obj-y += foo1.o foo2.o

  foo1.c:

    #include <linux/export.h>
    static void foo(void) {}
    EXPORT_SYMBOL(foo);

  foo2.c:

    void foo(void) {}

foo1.c exports the static symbol 'foo', but modpost cannot catch it
because it is fooled by foo2.c, which has a global symbol with the
same name.

s->is_static is cleared if a global symbol with the same name is found
somewhere, but EXPORT_SYMBOL() and the global symbol do not necessarily
belong to the same compilation unit.

This check should be done per compilation unit, but I do not know how
to do it in modpost. modpost runs against vmlinux.o or modules, which
merges multiple objects, then forgets their origin.

modpost cannot parse individual objects because they may not be ELF but
LLVM IR when CONFIG_LTO_CLANG=y.

Add a simple bash script to parse the output from ${NM}. This works for
CONFIG_LTO_CLANG=y because llvm-nm can dump symbols of LLVM IR files.

Revert 15bfc2348d.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)
2022-06-01 23:07:02 +09:00
Documentation NFSD 5.19 Release Notes 2022-05-26 20:52:24 -07:00
LICENSES LICENSES/LGPL-2.1: Add LGPL-2.1-or-later as valid identifiers 2021-12-16 14:33:10 +01:00
arch parisc: remove arch/parisc/nm 2022-05-29 18:39:35 +09:00
block Page cache changes for 5.19 2022-05-24 19:55:07 -07:00
certs Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
crypto certs: Factor out the blacklist hash creation 2022-05-23 18:47:49 +03:00
drivers - Enable DM core bioset's per-cpu bio cache if QUEUE_FLAG_POLL 2022-05-26 21:13:45 -07:00
fs v5.19 pull request 2022-05-26 21:08:40 -07:00
include v5.19 pull request 2022-05-26 21:08:40 -07:00
init Modules updates for v5.19-rc1 2022-05-26 17:13:43 -07:00
ipc fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00
kernel Modules updates for v5.19-rc1 2022-05-26 17:13:43 -07:00
lib Yang Shi has improved the behaviour of khugepaged collapsing of readonly 2022-05-26 12:32:41 -07:00
mm sysctl changes for v5.19-rc1 2022-05-26 16:57:20 -07:00
net v5.19 pull request 2022-05-26 21:08:40 -07:00
samples drm for 5.19-rc1 2022-05-25 16:18:27 -07:00
scripts kbuild: check static EXPORT_SYMBOL* by script instead of modpost 2022-06-01 23:07:02 +09:00
security linux-kselftest-kunit-5.19-rc1 2022-05-25 11:32:53 -07:00
sound sound updates for 5.19-rc1 2022-05-25 16:55:16 -07:00
tools S390: 2022-05-26 14:20:14 -07:00
usr Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
virt S390: 2022-05-26 14:20:14 -07:00
.clang-format genirq/msi: Make interrupt allocation less convoluted 2021-12-16 22:22:20 +01:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore kbuild: split the second line of *.mod into *.usyms 2022-05-08 03:16:59 +09:00
.mailmap Scheduler changes in this cycle were: 2022-05-24 11:11:13 -07:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: replace a Microchip AT91 maintainer 2022-02-09 11:30:01 +01:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Modules updates for v5.19-rc1 2022-05-26 17:13:43 -07:00
Makefile Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.