1
0
Fork 0
Commit Graph

120 Commits (b69d3987f4360a5e7e9e55465b3cdd0cc204b79e)

Author SHA1 Message Date
Sam Ravnborg 4ce6efed48 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
2008-03-23 21:38:54 +01:00
Geert Uytterhoeven b1d2675a64 kbuild: fix reversed symbol name order in modpost
XXXINIT_TO_INIT and XXXEXIT_TO_EXIT warnings use the reversed symbol name order
in the suggestion, e.g.:

    WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap()
    The function __meminit free_area_init_core() references
    a function __init setup_usemap().
    If free_area_init_core is only used by setup_usemap then
    annotate free_area_init_core with a matching annotation.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-19 20:45:14 +01:00
Mathieu Desnoyers b2e3e658b3 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>
2008-02-13 16:21:20 -08:00
Geert Uytterhoeven 7c0ac495e3 kbuild/modpost: Use warn() for announcing section mismatches
modpost: Use warn() for announcing section mismatches, for easy grepping for
warnings in build logs.

Also change an existing call from fprintf() to warn() while we're at it.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-09 10:43:58 +01:00
Sam Ravnborg f666751a0a kbuild/modpost: improve warnings if symbol is unknown
If we cannot determine the symbol then print
(unknown) to hint the reader that we failed to
find the symbol.
This happens with REL relocation records
in arm object files.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-09 10:43:58 +01:00
Sam Ravnborg fa95eb1f17 kbuild: do not warn about __*init/__*exit symbols being exported
We have several legitimate uses where we export symbols
annotated with one of:
__devinit, __cpuinit, __meminit and their exit counterpart.
So let's stop warning about those being exported in favour
of adding all sorts of workaround to silence the warning.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-03 08:58:08 +01:00
Sam Ravnborg e5f95c8b77 kbuild: print only total number of section mismatces found
We have too many section mismatches detected at the moment.
So silence modpost and prevent the option from being
set in a typical allyesconfig build.

Tell the user how to see all the deteils in the summary
message from modpost.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-02-03 08:58:07 +01:00
Sam Ravnborg e241a63037 kbuild: warn about ld added unique sections
If there is a mixture of specifying sections for code in gcc
and assembler then if the assembler code do not add
the "ax" flags the linker will see this as two different sections
and generate unique sections for each. ld does so by adding a dot
and a number.
Teach modpost to warn if a section shows up that match this
pattern - but do this only for non-debug sections.

It will result in warnings like this:

WARNING: vmlinux.o (.sched.text.1): unexpected section name.
The (.[number]+) following section name are ld generated and not expected.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

All warnings seen with a defconfig build for:
x86 (32+64bit) and sparc64 has been fixed (via respective maintainers).

arm, powerpc (64 bit), s390 (32 bit), ia64, alpha, sh4 checked - no
warnings seen with a defconfig build.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:19 +01:00
Sam Ravnborg 588ccd732b kbuild: add verbose option to Section mismatch reporting in modpost
If the config option CONFIG_SECTION_MISMATCH is not set and
we see a Section mismatch present the following to the user:

modpost: Found 1 section mismatch(es).
To see additional details select "Enable full Section mismatch analysis"
in the Kernel Hacking menu (CONFIG_SECTION_MISMATCH).

If the option CONFIG_SECTION_MISMATCH is selected
then be verbose in the Section mismatch reporting from mdopost.
Sample outputs:

WARNING: o-x86_64/vmlinux.o(.text+0x7396): Section mismatch in reference from the function discover_ebda() to the variable .init.data:ebda_addr
The function  discover_ebda() references
the variable __initdata ebda_addr.
This is often because discover_ebda lacks a __initdata
annotation or the annotation of ebda_addr is wrong.

WARNING: o-x86_64/vmlinux.o(.data+0x74d58): Section mismatch in reference from the variable pci_serial_quirks to the function .devexit.text:pci_plx9050_exit()
The variable pci_serial_quirks references
the function __devexit pci_plx9050_exit()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

WARNING: o-x86_64/vmlinux.o(__ksymtab+0x630): Section mismatch in reference from the variable __ksymtab_arch_register_cpu to the function .cpuinit.text:arch_register_cpu()
The symbol arch_register_cpu is exported and annotated __cpuinit
Fix this by removing the __cpuinit annotation of arch_register_cpu or drop the export.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:18 +01:00
Adrian Bunk 3ff6eecca4 remove __attribute_used__
Remove the deprecated __attribute_used__.

[Introduce __section in a few places to silence checkpatch /sam]

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:18 +01:00
Sam Ravnborg 58fb0d4f2f kbuild: simplified warning report in modpost
Refactor code so the warning report function
does nothing else than reporting warnings.
As a side effect some other code paths were cleaned
up by this.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:18 +01:00
Sam Ravnborg ff13f92690 kbuild: introduce a few helpers in modpost
Introducing helpers to retreive symbol and section
names cleaned up the code a bit.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:18 +01:00
Sam Ravnborg 157c23c80e kbuild: use simpler section mismatch warnings in modpost
The typical layout is now:
WARNING: vmlinux.o(.text+0x372ec): Section mismatch: reference to .devinit.text:pci_scan_one_pbm in 'psycho_scan_bus'

This is first step towards more readable warnings.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:21:18 +01:00
Sam Ravnborg eb8f689046 Use separate sections for __dev/__cpu/__mem code/data
Introducing separate sections for __dev* (HOTPLUG),
__cpu* (HOTPLUG_CPU) and __mem* (MEMORY_HOTPLUG)
allows us to do a much more reliable Section mismatch
check in modpost. We are no longer dependent on the actual
configuration of for example HOTPLUG.

This has the effect that all users see much more
Section mismatch warnings than before because they
were almost all hidden when HOTPLUG was enabled.
The advantage of this is that when building a piece
of code then it is much more likely that the Section
mismatch errors are spotted and the warnings will be
felt less random of nature.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg KH <greg@kroah.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Adrian Bunk <bunk@kernel.org>
2008-01-28 23:21:17 +01:00
Sam Ravnborg 6c5bd235bf kbuild: check section names consistently in modpost
Now that match() is introduced use it consistently so
we can share the section name definitions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:40 +01:00
Sam Ravnborg 10668220a9 kbuild: introduce blacklisting in modpost
Change the logic in modpost so we identify all the
bad combinations of sections that refer to other
sections.
Compared to the previous approach we are much less
dependent on knowledge of what additional sections
the tool chain uses and thus we can keep the false
positives low.

The implmentation is changed to use a table based
lookup and we now check all combinations in first
pass so we no longer need separate passes for init
and exit sections.

Tested that the same warnings are generated for
an allyesconfig build without CONFIG_HOTPLUG.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Adrian Bunk <bunk@kernel.org>
2008-01-28 23:14:40 +01:00
Sam Ravnborg 5b24c0715f kbuild: code refactoring in modpost
Split a too long function up in smaller bits to make
prgram logic easier to follow.
A few related changes done due to parameter
changes.

No functional changes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:40 +01:00
Sam Ravnborg 9ad21c3f3e 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>
2008-01-28 23:14:40 +01:00
Sam Ravnborg d1f25e6658 kbuild: fix so modpost can now check any .o file
It is very convinient to say:
scripts/mod/modpost mm/built-in.o

to check if any section mismatch errors occured
in mm/ (as an example).
Fix it so this is possible again.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:40 +01:00
Sam Ravnborg df578e7d83 kbuild: clean up modpost.c
akpm complained about overly long lines in modpost.c and
when started additional style issues were fixed:

o Updated my copyright
o Removed unneeded {}
o Drop assignments in if ()
o Spaces around operators
o Break long lines
o locate * near variable not type
o Fix a format specifier for sizeof()
o Corrected placement of '{' and '}'
o spaces to tabs (but use tabs only for indention)

modpost.c is not checkpatch clean. Readability were favoured
on top of checkpatch compliance.
But checkpatch were used to find additional stuff to clean up.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:38 +01:00
Andi Kleen 666ab414fe kbuild: fix a buffer overflow in modpost
When passing an file name > 1k the stack could be overflowed.
Not really a security issue, but still better plugged.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:36 +01:00
Andi Kleen 58b7a68de3 kbuild: fix format string warnings in modpost
Fix wrong format strings in modpost exposed by the previous patch.
Including one missing argument -- some random data was printed instead.
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:36 +01:00
Andi Kleen 6d9a89ea4b kbuild: declare the modpost error functions as printf like
This way gcc can warn for wrong format strings
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-01-28 23:14:36 +01:00
Trent Piepho 4b21960f90 kbuild: modpost problem when symbols move from one module to another
When part of build an external module tree, modpost first reads in the
kernel's and then the external tree's Module.symvers files.  From these files
it establishes a symbol => module mapping.  When it later reads in each module
built and processes the symbols it finds, it discovers the symbol=>module
mapping from Module.symvers and leaves it as it is.

The problem comes with a module has been re-named or a symbol has moved from
one module to another, since the Module.symvers file was generated.  modpost
does not update the symbol=>module mapping when it finds the new location of
the symbol when scanning the newly built modules.  This results in the module
containing incorrect dependency information and the new Module.symvers file
written by modpost will also contain the incorrect mappings, perpetuating the
problem to the next build, and so on.

When building the out of kernel development tree for kernel subsystem, like
v4l-dvb or ALSA, deleting the external Module.symvers file before building
(which the kernel build system doesn't do and shouldn't be necessary anyway),
won't fix the problem.  modpost still reads the kernel's Module.symvers, and
since we a building a kernel subsystem, it will define the same symbols as the
external modules.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-10-18 13:35:49 +02:00
Petr Stetiar a83710e584 kbuild: fix segfault in modpost
Fix modpost segfault.

Before:
-------
ynezz@ntbk:~/linux-2.6.git$ scripts/mod/modpost vmlinux ath_pci.o
Segmentation fault

After:
------
ynezz@ntbk:~/linux-2.6.git$ scripts/mod/modpost vmlinux ath_pci.o
FATAL: section header offset=815726848 in file 'ath_pci.o' is bigger then filesize=153968

Sam: This seems to warn for a binutils issue. Anyway modpost should not
segfault.

Signed-off-by: Petr Stetiar <ynezz@true.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-10-12 21:15:30 +02:00
Pavel Emelyanov 4665079cbb [NETNS]: Move some code into __init section when CONFIG_NET_NS=n
With the net namespaces many code leaved the __init section,
thus making the kernel occupy more memory than it did before.
Since we have a config option that prohibits the namespace
creation, the functions that initialize/finalize some netns
stuff are simply not needed and can be freed after the boot.

Currently, this is almost not noticeable, since few calls
are no longer in __init, but when the namespaces will be
merged it will be possible to free more code. I propose to
use the __net_init, __net_exit and __net_initdata "attributes"
for functions/variables that are not used if the CONFIG_NET_NS
is not set to save more space in memory.

The exiting functions cannot just reside in the __exit section,
as noticed by David, since the init section will have
references on it and the compilation will fail due to modpost
checks. These references can exist, since the init namespace
never dies and the exit callbacks are never called. So I
introduce the __exit_refok attribute just like it is already
done with the __init_refok.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-10 16:54:58 -07:00
Ralf Baechle ad0b142772 kbuild: whitelist references from __dbe_table to .init
This is needed on MIPS where the same mechanism as get_user() is used to
intercept bus error exceptions for some hardware probes.  Without this
patch modpost will throw spurious warnings:

  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  MODPOST vmlinux
WARNING: arch/mips/sgi-ip22/built-in.o(__dbe_table+0x0): Section mismatch: reference to .init.text:

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-31 15:39:40 -07:00
Sam Ravnborg cb7e51d8b1 kbuild: fix modpost warnings for xtensa
The Xtensa architecture places literal pools in sections separate
from the instructions. The corresponsing text sections, therefore,
reference the .literal section, and we have to suppress those
warnings.

The naming convention defines the name for a literal
section as .SECTION.literal, unless .SECTION is .text. In that case
the name is only .literal. Using strncmp() instead of strcmp()
to compare the from-section with .SECTION.init.refok in pattern 0
should not cause any regressions for other architectures.

We also need to suppress warnings for two informational
sections (.xt.lit and .xt.prop) used by the Xtensa architecture.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-25 22:24:52 +02:00
Sam Ravnborg 83cda2bb37 kbuild: be more foregiving on init section naming
In the whitelist function of modpost now use the same
check to identify init_section as in other places of modpost.
This has the effect that we now recognize sections named
.init.text.19 as init sections and we no longer warn
when we see these.

At the same time make surrounding code readable by dropping
use of temporary flags.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-25 21:52:31 +02:00
Sam Ravnborg 2f5ee61904 kbuild: rearrange a few function in modpost
This is a preparational patch that just move
two functions and add one (for now unused) function.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-25 21:46:40 +02:00
Sam Ravnborg 8d8d8289df kbuild: do not do section mismatch checks on vmlinux in 2nd pass
We already check and warn about section mismatches from vmlinux
(build as vmlinux.o) during first pass so skip the checks
during the 2nd pass where we process modules.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-25 21:14:15 +02:00
Al Viro 3a5df1d451 m68k: teach modpost about .m68_fixup
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-20 08:24:49 -07:00
Ralf Baechle eec73e887a Whitelist references from __dbe_table to .init
This is needed on MIPS where the same mechanism as get_user() is used to
intercept bus error exceptions for some hardware probes.  Without this
patch modpost will throw spurious warnings:

  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  MODPOST vmlinux
WARNING: arch/mips/sgi-ip22/built-in.o(__dbe_table+0x0): Section mismatch: reference to .init.text:

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-17 11:15:48 +02:00
Jan Beulich a5eb6a502b modpost white list pattern adjustment
gcc puts data into .data.rel or .data.rel.* on some architectures (e.g.
ia64) or under certain conditions, so whatever is legal relative to
.data should also be legal for those other sections. Fixes a few
modpost warnings on ia64.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-17 11:10:21 +02:00
Sam Ravnborg 741f98fe29 kbuild: do section mismatch check on full vmlinux
Previously we did do the check on the .o files used to link
vmlinux but that failed to find questionable references across
the .o files.
Create a dedicated vmlinux.o file used only for section mismatch checks
that uses the defualt linker script so section does not get renamed.

The vmlinux.o may later be used as part of the the final link of vmlinux
but for now it is used fo section mismatch only.
For a defconfig build this is instant but for an allyesconfig this
add two minutes to a full build (that anyways takes ~2 hours).

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-17 10:54:06 +02:00
Sam Ravnborg 1e29a706ee kbuild: whitelist references from variables named _timer to .init.text
arm uses a lot of ops structures named *_timer that has legitimite
references to .init.text.
So let's add this variable to the list of variables that may reference
.init.text without causing any warning.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:25:00 +02:00
Sam Ravnborg 92cc6b0725 kbuild: remove hardcoded _logo names from modpost
Replaced this with a __init_refok marker
in front of fb_find_logo().

I think that the __initdata marker for the logo's are
wrong but I have not justified this so I did not remove it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:24:55 +02:00
Sam Ravnborg d3ab78560b kbuild: remove hardcoded apic_es7000 from modpost
Replace the hardcoded variable name apic_es7000 in modpost
with a __initdata_refok marker.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:24:51 +02:00
Sam Ravnborg 6fc53bae3d kbuild: warn about references from .init.text to .exit.text
The .exit.text section may be discarded either at build or at runtime.
So let modpost warn if this situation is detected.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:24:47 +02:00
Sam Ravnborg 1d8af559f9 kbuild: consolidate section checks
Move more checks from whitelist to the section check functions.
Remove the redundent pci_fixup check.
Renumber the patterns.
No functional changes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:24:13 +02:00
Sam Ravnborg 1087247b7d kbuild: refactor code in modpost to improve maintainability
There were a great deal of overlap between the two functions
that check which sections may reference .init.text and .exit.text.
Factor out common check to a separate function and
sort entries in the original functions.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 23:21:34 +02:00
Sam Ravnborg b28242e7e3 kbuild: ignore section mismatch warnings originating from .note section
.note* sections are ELF notes, which are typically used by external
tools to examine the kernel image.  Since this is removed from any
runtime consideration, it's OK to reference any section from a .note*
section.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 22:41:47 +02:00
Jeremy Fitzhardinge 1de564bbf8 kbuild: .paravirtprobe section is obsolete, so modpost doesn't need to handle it
The .paravirtprobe section is obsolete, so modpost doesn't need to handle it.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 22:41:11 +02:00
Stephen Rothwell 1abe02fef9 kbuild: suppress modpost warnings for references from the .toc section as used by powerpc
We should do better here by effetively "dereferencing" references to
the .toc (or the .got2) section, but that is much harder.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 22:40:22 +02:00
Sam Ravnborg 56a974fa2d kbuild: make better section mismatch reports on arm
With this change we can find more symbols hereby improving
the readability of the warnings.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-07-16 22:39:35 +02:00
Atsushi Nemoto ae4ac12323 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>
2007-07-16 21:48:49 +02:00
Sam Ravnborg 2648a53acf kbuild: fix sh64 section mismatch problems
There's a special .cranges section that is almost always generated,
with data being moved to the appropriate section by the linker at a later
stage.

To give a bit of background, sh64 has both a native SHmedia instruction
set (32-bit instructions) and SHcompact (which is compatability with
normal SH -- 16-bit, a massively reduced register set, etc.). code ranges
are emitted when we're using the 32-bit ABI, but not the 64-bit one.

It is a special staging section used solely by binutils where code with
different flags get placed (more specifically differing flags for input
and output sections), before being lazily merged by the linker.

The closest I've been able to find to documentation is:
  http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/emultempl/sh64elf.em?rev=1.10&content-type=text/x-cvsweb-markup&cvsroot=src

It's an array of 8-byte Elf32_CRange structure given in
  http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/elf32-sh64.h?rev=1.4&content-type=text/x-cvsweb-markup&cvsroot=src
that describes for which ISA a range is used.

Silence the warnings by allowing references from .init.text to .cranges.

The following warnings are fixed:

WARNING: init/built-in.o(.cranges+0x0): Section mismatch: reference to .init.text:
WARNING: init/built-in.o(.cranges+0xa): Section mismatch: reference to .init.text:
WARNING: init/built-in.o(.cranges+0x14): Section mismatch: reference to .init.text:
WARNING: init/built-in.o(.cranges+0x1e): Section mismatch: reference to .init.text:
WARNING: init/built-in.o(.cranges+0x28): Section mismatch: reference to .init.text:
WARNING: init/built-in.o(.cranges+0x32): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x50): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x5a): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x64): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0xfa): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x104): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x10e): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x14a): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x154): Section mismatch: reference to .init.text:
WARNING: kernel/built-in.o(.cranges+0x15e): Section mismatch: reference to .init.text:
WARNING: mm/built-in.o(.cranges+0x6e): Section mismatch: reference to .init.text:
WARNING: mm/built-in.o(.cranges+0x78): Section mismatch: reference to .init.text:
WARNING: mm/built-in.o(.cranges+0x82): Section mismatch: reference to .init.text:
WARNING: mm/built-in.o(.cranges+0xaa): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x136): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x140): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x14a): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x168): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x1f4): Section mismatch: reference to .init.text:
WARNING: fs/built-in.o(.cranges+0x1fe): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x302): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x30c): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x316): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x3a2): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x3ac): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x4ce): Section mismatch: reference to .init.text:
WARNING: net/built-in.o(.cranges+0x4d8): Section mismatch: reference to .init.text:

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Cc: Kaz Kojima <kkojima@rr.iij4u.or.jp>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-06-11 21:52:04 +02:00
Linus Torvalds efa5bf1dd2 Revert "kbuild: make better section mismatch reports on i386, arm and mips"
This reverts commit f892b7d480, 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-21 18:41:17 -07:00
Sam Ravnborg 577a32f620 mm: fix section mismatch warnings
modpost had two cases hardcoded for mm/
Shift over to __init_refok and kill the
hardcoded function names in modpost.

This has the drawback that the functions
will always be kept no matter configuration.
With previous code the function were placed in
init section if configuration allowed it.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-05-19 09:11:58 +02:00
Sam Ravnborg 92080309df init/main: use __init_refok to fix section mismatch
Kill a special case in modpost by introducing the
__init_refok marker.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-05-19 09:11:58 +02:00