History log of /scripts/mod/modpost.h
Revision Date Author Comments
258f742635360175564e9470eb060ff4d4b984e7 10-Apr-2012 Frank Rowand <frank.rowand@am.sony.com> modpost: Fix modpost license checking of vmlinux.o

Commit f02e8a6596b7 ("module: Sort exported symbols") sorts symbols
placing each of them in its own elf section. This sorting and merging
into the canonical sections are done by the linker.

Unfortunately modpost to generate Module.symvers file parses vmlinux.o
(which is not linked yet) and all modules object files (which aren't
linked yet). These aren't sanitized by the linker yet. That breaks
modpost that can't detect license properly for modules.

This patch makes modpost aware of the new exported symbols structure.

[ This above is a slightly corrected version of the explanation of the
problem, copied from commit 62a2635610db ("modpost: Fix modpost's
license checking V3"). That commit fixed the problem for module
object files, but not for vmlinux.o. This patch fixes modpost for
vmlinux.o. ]

Signed-off-by: Frank Rowand <frank.rowand@am.sony.com>
Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6845756b29e4c4e7db41e2d75cafa9d091bc1c07 20-May-2011 Anders Kaseorg <andersk@ksplice.com> modpost: Update 64k section support for binutils 2.18.50

Binutils 2.18.50 made a backwards-incompatible change in the way it
writes ELF objects with over 65280 sections, to improve conformance
with the ELF specification and interoperability with other ELF tools.
Specifically, it no longer adds 256 to section indices SHN_LORESERVE
and higher to skip over the reserved range SHN_LORESERVE through
SHN_HIRESERVE; those values are only considered special in the
st_shndx field, and not in other places where section indices are
stored. See:

http://sourceware.org/bugzilla/show_bug.cgi?id=5900
http://groups.google.com/group/generic-abi/browse_thread/thread/e8bb63714b072e67/6c63738f12cc8a17

Signed-off-by: Anders Kaseorg <andersk@ksplice.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1ce53adf13a54375d2a5c7cdbe341b2558389615 29-Jul-2010 Denys Vlasenko <vda.linux@googlemail.com> modpost: support objects with more than 64k sections

This patch makes modpost able to process object files with more than
64k sections. Needed for huge kernel builds (allyesconfig, for example)
with -ffunction-sections. 64k sections handling is covered, for example,
by this document:

"IA-64 gABI Proposal 74: Section Indexes"
http://www.codesourcery.com/public/cxx-abi/abi/prop-74-sindex.html

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
a8773769d1a1e08d0ca15f890515401ab3860637 16-Nov-2009 Wenji Huang <wenji.huang@oracle.com> Kbuild: clear marker out of modpost

Remove the unnecessary functions and variables.

Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
4ce6efed48d736e3384c39ff87bda723e1f8e041 23-Mar-2008 Sam Ravnborg <sam@uranus.ravnborg.org> kbuild: soften modpost checks when doing cross builds

The module alias support in the kernel have a consistency
check where it is checked that the size of a structure
in the kernel and on the build host are the same.
For cross builds this check does not make sense so detect
when we do cross builds and silently skip the check in these
situations.
This fixes a build bug for a wireless driver when cross building
for arm.

Acked-by: Michael Buesch <mb@bu3sch.de>
Tested-by: Gordon Farquharson <gordonfarquharson@gmail.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: stable@kernel.org
b2e3e658b344c6bcfb8fb694100ab2f2b5b2edb0 14-Feb-2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Linux Kernel Markers: create modpost file

This adds some new magic in the MODPOST phase for CONFIG_MARKERS. Analogous
to the Module.symvers file, the build will now write a Module.markers file
when CONFIG_MARKERS=y is set. This file lists the name, defining module, and
format string of each marker, separated by \t characters. This simple text
file can be used by offline build procedures for instrumentation code,
analogous to how System.map and Module.symvers can be useful to have for
kernels other than the one you are running right now.

The strings are made easy to extract by having the __trace_mark macro define
the name and format together in a single array called __mstrtab_* in the
__markers_strings section. This is straightforward and reliable as long as
the marker structs are always defined by this macro. It is an unreasonable
amount of hairy work to extract the string pointers from the __markers section
structs, which entails handling a relocation type for every machine under the
sun.

Mathieu :
- Ran through checkpatch.pl

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: David Smith <dsmith@redhat.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9ad21c3f3ecffeb56be7b35030d7ec2f30b6fe11 18-Jan-2008 Sam Ravnborg <sam@ravnborg.org> kbuild: try harder to find symbol names in modpost

The relocation record sometimes contained an address
which was not an exactly match for a symbol.

Implment some simple logic such that if there
is a symbol within 20 bytes of the address contained
in the relocation record then print the name of this
symbol.

With this change modpost could find symbol names
for the remaining .init.text symbols in my
allyesconfig build for x86_64.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
4f4c4ee1b79b9102db19ff39f7cb11abddaa43e1 12-Aug-2007 Sam Ravnborg <sam@ravnborg.org> kbuild: Use Elfnn_Half as replacement for Elfnn_Section

The Elfnn_Section is not available on all platforms,
noteworthy are cygwin.
Use the safe replacement _Half.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
ae4ac12323c0ff80528cac3269151d580e23f923 22-May-2007 Atsushi Nemoto <anemo@mba.ocn.ne.jp> kbuild: make better section mismatch reports on i386 and mips

On i386 and MIPS, warn_sec_mismatch() sometimes fails to show
usefull symbol name. This is because empty 'refsym' due to 0 r_addend
value. This patch is to adjust r_addend value, consulting with
apply_relocate() routine in kernel code.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
efa5bf1dd2cf3cdee0bfe97cfd76ff2296179ae4 22-May-2007 Linus Torvalds <torvalds@woody.linux-foundation.org> Revert "kbuild: make better section mismatch reports on i386, arm and mips"

This reverts commit f892b7d480eec809a5dfbd6e65742b3f3155e50e, which
totally broke the build on x86 with CONFIG_RELOCATABLE (which, as far as
I can tell, is the only case where it should even matter!) due to a
SIGSEGV in modpost.

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f892b7d480eec809a5dfbd6e65742b3f3155e50e 16-May-2007 Atsushi Nemoto <anemo@mba.ocn.ne.jp> kbuild: make better section mismatch reports on i386, arm and mips

On i386, ARM and MIPS, warn_sec_mismatch() sometimes fails to show
usefull symbol name. This is because empty 'refsym' due to 0 r_addend
value. This patch is to adjust r_addend value, consulting with
apply_relocate() routine in kernel code.

Without this patch:
MODPOST vmlinux
WARNING: init/built-in.o - Section mismatch: reference to .init.text: from .text between 'rest_init' (at offset 0xf4) and 'try_name'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text between 'kmem_cache_create' (at offset 0x18a39) and 'cache_reap'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text between 'kmem_cache_create' (at offset 0x18a6b) and 'cache_reap'

With this patch:
MODPOST vmlinux
WARNING: mm/built-in.o - Section mismatch: reference to .init.text:set_up_list3s from .text between 'kmem_cache_create' (at offset 0x18a39) and 'cache_reap'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text:set_up_list3s from .text between 'kmem_cache_create' (at offset 0x18a6b) and 'cache_reap'

Now modpost can detect "kernel_init" name (and whitelist it) and show
"set_up_list3s" name.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2a11665945d510e1a4df8dc44dc3668b01945ade 07-Oct-2006 Matthew Wilcox <matthew@wil.cx> kbuild: distinguish between errors and warnings in modpost

Some of modpost's warnings are fatal, and some are not. Adopt the
compiler distinction between errors and warnings by calling merror()
for fatal diagnostics and warn() for non-fatal ones.
merror() was used as replacemtn for error() to avoid clash with glibc

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
c96fca213737a5b4bc569e1d9a0ef6adeff661e9 01-Jul-2006 Sam Ravnborg <sam@mars.ravnborg.org> kbuild: warn when a moduled uses a symbol marked UNUSED

We now have infrastructure in place to mark an EXPORTed symbol
as unused. So the natural next step is to warn during buildtime when
a module uses a symbol marked UNUSED.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
b817f6feff4a565b08f0e699a5790b4008b8f494 09-Jun-2006 Sam Ravnborg <sam@mars.ravnborg.org> kbuild: check license compatibility when building modules

Modules that uses GPL symbols can no longer be build with kbuild,
the build will fail during the modpost step.
When a GPL-incompatible module uses a EXPORT_SYMBOL_GPL_FUTURE symbol
then warn during modpost so author are actually notified.

The actual license compatibility check is shared with the kernel
to make sure it is in sync.

Patch originally from: Andreas Gruenbacher <agruen@suse.de> and
Ram Pai <linuxram@us.ibm.com>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
bd5cbcedf446e2f37cf2a37f533a7e1d7dff9312 09-Jun-2006 Ram Pai <linuxram@us.ibm.com> kbuild: export-type enhancement to modpost.c

This patch provides the ability to identify the export-type of each
exported symbols in Module.symvers.

NOTE: It updates the Module.symvers file with the additional
information as shown below.

0x0f8b92af platform_device_add_resources vmlinux EXPORT_SYMBOL_GPL
0xcf7efb2a ethtool_op_set_tx_csum vmlinux EXPORT_SYMBOL

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Avantika Mathur <mathur@us.ibm.com>
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
eae07ac607f317ee6781983d3f9d8f77ef144b45 21-May-2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp> [PATCH] kbuild: fix modpost segfault for 64bit mipsel kernel

Here is an updated r_info layout fix. Please apply "check SHT_REL
sections" patch before this.

64bit mips has different r_info layout. This patch fixes modpost
segfault for 64bit little endian mips kernel.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2c1a51f39d9551a514d7a089d01c23c0c3a54ab8 21-May-2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp> [PATCH] kbuild: check SHT_REL sections

I found that modpost can not detect section mismatch on mips and i386. On
mips64, the modpost (with r_info layout fix) can detect it. The current
modpst only checks SHT_RELA section but I suppose SHT_REL section should be
checked also. This patch does not contain r_info layout fix. I'll post an
updated r_info layout fix on next mail.

Check SHT_REL sections as like as SHT_RELA sections to detect section
mismatch.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
601e7f024edbea8018de34c83a7398623214e636 08-May-2006 Linus Torvalds <torvalds@g5.osdl.org> Revert "kbuild: fix modpost segfault for 64bit mipsel kernel"

This reverts commit c8d8b837ebe4b4f11e1b0c4a2bdc358c697692ed, which
caused problems for the x86 build. Quoth Sam:

"It was discussed on mips list but apparently the fix was bogus. I
will not have time to look into it so mips can carry this local fix
until we get a proper fix in mainline."

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
c8d8b837ebe4b4f11e1b0c4a2bdc358c697692ed 24-Apr-2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp> kbuild: fix modpost segfault for 64bit mipsel kernel

64bit mips has different r_info layout. This patch fixes modpost
segfault for 64bit little endian mips kernel.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
62070fa42c4ac23d1d71146a4c14702302b80245 03-Mar-2006 Sam Ravnborg <sam@mars.ravnborg.org> kbuild: kill trailing whitespace in modpost & friends

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
b39927cf4cc5a9123d2b157ffd396884cb8156eb 17-Feb-2006 Sam Ravnborg <sam@mars.ravnborg.org> kbuild: check for section mismatch during modpost stage

Section mismatch is identified as references to .init*
sections from non .init sections. And likewise references
to .exit.* sections outside .exit sections.

.init.* sections are discarded after a module is initialized
and references to .init.* sections are oops candidates.
.exit.* sections are discarded when a module is built-in and
thus references to .exit are also oops candidates.

The checks were possible to do using 'make buildcheck' which
called the two perl scripts: reference_discarded.pl and
reference_init.pl. This patch just moves the same functionality
inside modpost and the scripts are then obsoleted.
They will though be kept for a while so users can do double
checks - but note that some .o files are skipped by the perl scripts
so result is not 1:1.
All credit for the concept goes to Keith Owens who implemented
the original perl scrips - this patch just moves it to modpost.

Compared to the perl script the implmentation in modpost will be run
for each kernel build - thus catching the error much sooner, but
the downside is that the individual .o file are not always identified.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
cb80514d9c517cc1d101ef304529a0e9b76b4468 28-Jan-2006 Sam Ravnborg <sam@mars.ravnborg.org> kbuild: use warn()/fatal() consistent in modpost

modpost.c provides warn() and fatal() - so use them all over the place.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!