summaryrefslogtreecommitdiffstats
path: root/scripts/link-vmlinux.sh
Commit message (Collapse)AuthorAgeFilesLines
* kallsyms: fix percpu vars on x86-64 with relocation.Rusty Russell2014-03-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | x86-64 has a problem: per-cpu variables are actually represented by their absolute offsets within the per-cpu area, but the symbols are not emitted as absolute. Thus kallsyms naively creates them as offsets from _text, meaning their values change if the kernel is relocated (especially noticeable with CONFIG_RANDOMIZE_BASE): $ egrep ' (gdt_|_(stext|_per_cpu_))' /root/kallsyms.nokaslr 0000000000000000 D __per_cpu_start 0000000000004000 D gdt_page 0000000000014280 D __per_cpu_end ffffffff810001c8 T _stext ffffffff81ee53c0 D __per_cpu_offset $ egrep ' (gdt_|_(stext|_per_cpu_))' /root/kallsyms.kaslr1 000000001f200000 D __per_cpu_start 000000001f204000 D gdt_page 000000001f214280 D __per_cpu_end ffffffffa02001c8 T _stext ffffffffa10e53c0 D __per_cpu_offset Making them absolute symbols is the Right Thing, but requires fixes to the relocs tool. So for the moment, we add a --absolute-percpu option which makes them absolute from a kallsyms perspective: $ egrep ' (gdt_|_(stext|_per_cpu_))' /proc/kallsyms # no KASLR 0000000000000000 A __per_cpu_start 000000000000a000 A gdt_page 0000000000013040 A __per_cpu_end ffffffff802001c8 T _stext ffffffff8099b180 D __per_cpu_offset ffffffff809a3000 D __per_cpu_load $ egrep ' (gdt_|_(stext|_per_cpu_))' /proc/kallsyms # With KASLR 0000000000000000 A __per_cpu_start 000000000000a000 A gdt_page 0000000000013040 A __per_cpu_end ffffffff89c001c8 T _stext ffffffff8a39d180 D __per_cpu_offset ffffffff8a3a5000 D __per_cpu_load Based-on-the-original-screenplay-by: Andy Honig <ahonig@google.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Kees Cook <keescook@chromium.org>
* scripts/link-vmlinux.sh: only filter kernel symbols for armMing Lei2013-12-101-1/+3
| | | | | | | | | | | | | | | | | Actually CONFIG_PAGE_OFFSET isn't same with PAGE_OFFSET, so it isn't easy to figue out PAGE_OFFSET defined in header file from scripts. Because CONFIG_PAGE_OFFSET may not be defined in some ARCHs( 64bit ARCH), or defined as bogus value in !MMU case, so this patch only applys the filter on ARM when CONFIG_PAGE_OFFSET is defined as the original problem is only on ARM. Cc: <stable@vger.kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Fixes: f6537f2f0eba4eba3354e48dbe3047db6d8b6254 Singed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* scripts/kallsyms: filter symbols not in kernel address spaceMing Lei2013-11-021-0/+2
| | | | | | | | | | | | | | | | | | | This patch uses CONFIG_PAGE_OFFSET to filter symbols which are not in kernel address space because these symbols are generally for generating code purpose and can't be run at kernel mode, so we needn't keep them in /proc/kallsyms. For example, on ARM there are some symbols which may be linked in relocatable code section, then perf can't parse symbols any more from /proc/kallsyms, this patch fixes the problem (introduced b9b32bf70f2fb710b07c94e13afbc729afe221da) Cc: Russell King <linux@arm.linux.org.uk> Cc: linux-arm-kernel@lists.infradead.org Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: stable@vger.kernel.org
* CONFIG_SYMBOL_PREFIX: cleanup.Rusty Russell2013-03-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have CONFIG_SYMBOL_PREFIX, which three archs define to the string "_". But Al Viro broke this in "consolidate cond_syscall and SYSCALL_ALIAS declarations" (in linux-next), and he's not the first to do so. Using CONFIG_SYMBOL_PREFIX is awkward, since we usually just want to prefix it so something. So various places define helpers which are defined to nothing if CONFIG_SYMBOL_PREFIX isn't set: 1) include/asm-generic/unistd.h defines __SYMBOL_PREFIX. 2) include/asm-generic/vmlinux.lds.h defines VMLINUX_SYMBOL(sym) 3) include/linux/export.h defines MODULE_SYMBOL_PREFIX. 4) include/linux/kernel.h defines SYMBOL_PREFIX (which differs from #7) 5) kernel/modsign_certificate.S defines ASM_SYMBOL(sym) 6) scripts/modpost.c defines MODULE_SYMBOL_PREFIX 7) scripts/Makefile.lib defines SYMBOL_PREFIX on the commandline if CONFIG_SYMBOL_PREFIX is set, so that we have a non-string version for pasting. (arch/h8300/include/asm/linkage.h defines SYMBOL_NAME(), too). Let's solve this properly: 1) No more generic prefix, just CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX. 2) Make linux/export.h usable from asm. 3) Define VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR(). 4) Make everyone use them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: James Hogan <james.hogan@imgtec.com> Tested-by: James Hogan <james.hogan@imgtec.com> (metag)
* kbuild: Fix reading of .config in link-vmlinux.shMichal Marek2013-02-251-1/+8
| | | | | | | | | | The shell '.' command is not required to search the current directory as a fallback and in fact newer versions of bash in sh-mode do not do this. Force reading the file from the current directory if $KCONFIG_CONFIG contains no '/'. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/link-vmlinux.sh: source variables from KCONFIG_CONFIGMichael Grzeschik2013-02-221-1/+1
| | | | | | | | | | Its possible to superseed the config file with KCONFIG_CONFIG and have completely no .config in the tree. The current script is sourcing .config in every case, so the kernel will never build succesfully. This patch fixes that issue by sourcing KCONFIG_CONFIG instead. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Merge branch 'for-linus' of ↵Linus Torvalds2012-09-121-1/+6
|\ | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lliubbo/blackfin Pull blackfin updates from Bob Liu: "One kbuild and a smp build fix." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lliubbo/blackfin: kbuild: add symbol prefix arg to kallsyms blackfin: smp: adapt to generic smp helpers
| * kbuild: add symbol prefix arg to kallsymsJames Hogan2012-09-111-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 ("kbuild: link of vmlinux moved to a script") introduced in v3.5-rc1 broke kallsyms on architectures which have symbol prefixes. The --symbol-prefix argument used to be added to the KALLSYMS command line from the architecture Makefile, however this isn't picked up by the new scripts/link-vmlinux.sh. This resulted in symbols like kallsyms_addresses being added which weren't correctly overriding the weak symbols such as _kallsyms_addresses. These could then trigger BUG_ONs in kallsyms code. This is fixed by removing the KALLSYMS addition from the architecture Makefile, and using CONFIG_SYMBOL_PREFIX in the link-vmlinux.sh script to determine whether to add the --symbol-prefix argument. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Bob Liu <lliubbo@gmail.com>
* | link-vmlinux.sh: Fix stray "echo" in error messageMichal Marek2012-08-101-1/+1
|/ | | | | Reported-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
* kbuild: Print errors to stderrMichal Marek2012-07-071-2/+2
| | | | | | | | | ... at least in the top-level Makefile and scripts/link-vmlinux.sh. There are some more instances of the 'echo <error>; exit 1' pattern in some arch Makefiles and kconfig. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Merge branch 'kbuild' of ↵Linus Torvalds2012-05-281-0/+10
| | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild Pull kbuild updates from Michal Marek. Fixed up nontrivial merge conflict in Makefile as per Stephen Rothwell and linux-next (and trivial arch/sparc/Makefile changes due to removed sparc32 logic). * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: mips: Fix KBUILD_CPPFLAGS definition kbuild: fix ia64 link kbuild: document KBUILD_LDS, KBUILD_VMLINUX_{INIT,MAIN} and LDFLAGS_vmlinux kbuild: link of vmlinux moved to a script kbuild: refactor final link of sparc32 kbuild: drop unused KBUILD_VMLINUX_OBJS from top-level Makefile kbuild: Makefile: remove unnecessary check for m68knommu ARCH
* kbuild: fix ia64 linkSam Ravnborg2012-05-101-2/+2
| | | | | | | | | | | | | | | | | | | ia64 build failed like this: CC init/version.o LD init/built-in.o KSYM .tmp_kallsyms1.o ld: .tmp_kallsyms1.o: linking constant-gp files with non-constant-gp files ld: failed to merge target specific data of file .tmp_kallsyms1.o make: *** [vmlinux] Error 1 This was introduced when link of vmlinux was migrated to a script. Add missing option to as to fix this. Reported-by: Tony Luck <tony.luck@gmail.com> Tested-by: Tony Luck <tony.luck@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
* kbuild: link of vmlinux moved to a scriptSam Ravnborg2012-05-051-0/+211
Move the final link of vmlinux to a script to improve readability and maintainability of the code. The Makefile fragments used to link vmlinux has over the years seen far too many changes and the logic had become hard to follow. As the process by nature is serialized there was nothing gained including this in the Makefile. "um" has special link requirments - and the only way to handle this was to hard-code the linking of "um" in the script. This was better than trying to modularize it only for the benefit of "um" anyway. The shell script has been improved after input from: Arnaud Lacombe <lacombar@gmail.com> Nick Bowler <nbowler@elliptictech.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Arnaud Lacombe <lacombar@gmail.com> Cc: Nick Bowler <nbowler@elliptictech.com> Cc: Richard Weinberger <richard@nod.at> Signed-off-by: Michal Marek <mmarek@suse.cz>
OpenPOWER on IntegriCloud