summaryrefslogtreecommitdiff
path: root/scripts/mod/modpost.h
AgeCommit message (Collapse)Author
2015-08-20Avoid conflict with host definitions when cross-compilingPavel Fedin
Certain platforms (e. g. BSD-based ones) define some ELF constants according to host. This patch fixes problems with cross-building Linux kernel on these platforms (e. g. building ARM 32-bit version on x86-64 host). Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Signed-off-by: Michal Marek <mmarek@suse.com>
2014-02-13Kbuild, lto: Drop .number postfixes in modpostAndi Kleen
LTO turns all global symbols effectively into statics. This has the side effect that they all have a .NUMBER postfix to make them unique. In modpost drop this postfix because it confuses it. Signed-off-by: Andi Kleen <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1391846481-31491-8-git-send-email-ak@linux.intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2012-04-09modpost: Fix modpost license checking of vmlinux.oFrank Rowand
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>
2011-05-19modpost: Update 64k section support for binutils 2.18.50Anders Kaseorg
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>
2010-08-03modpost: support objects with more than 64k sectionsDenys Vlasenko
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>
2009-12-15Kbuild: clear marker out of modpostWenji Huang
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>
2008-03-23kbuild: soften modpost checks when doing cross buildsSam Ravnborg
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
2008-02-13Linux Kernel Markers: create modpost fileMathieu Desnoyers
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>
2008-01-28kbuild: try harder to find symbol names in modpostSam Ravnborg
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>
2007-10-12kbuild: Use Elfnn_Half as replacement for Elfnn_SectionSam Ravnborg
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>
2007-07-16kbuild: make better section mismatch reports on i386 and mipsAtsushi Nemoto
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>
2007-05-21Revert "kbuild: make better section mismatch reports on i386, arm and mips"Linus Torvalds
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>
2007-05-19kbuild: make better section mismatch reports on i386, arm and mipsAtsushi Nemoto
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>
2007-05-02kbuild: distinguish between errors and warnings in modpostMatthew Wilcox
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>
2006-07-01kbuild: warn when a moduled uses a symbol marked UNUSEDSam Ravnborg
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>
2006-06-09kbuild: check license compatibility when building modulesSam Ravnborg
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>
2006-06-09kbuild: export-type enhancement to modpost.cRam Pai
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>
2006-05-21[PATCH] kbuild: fix modpost segfault for 64bit mipsel kernelAtsushi Nemoto
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>
2006-05-21[PATCH] kbuild: check SHT_REL sectionsAtsushi Nemoto
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>
2006-05-08Revert "kbuild: fix modpost segfault for 64bit mipsel kernel"Linus Torvalds
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>
2006-04-30kbuild: fix modpost segfault for 64bit mipsel kernelAtsushi Nemoto
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>
2006-03-03kbuild: kill trailing whitespace in modpost & friendsSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-02-19kbuild: check for section mismatch during modpost stageSam Ravnborg
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>
2006-02-19kbuild: use warn()/fatal() consistent in modpostSam Ravnborg
modpost.c provides warn() and fatal() - so use them all over the place. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
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!