0b0bf7a3cc
The latest toolchains can produce a new ELF section in DSOs and dynamically-linked executables. The new section ".gnu.hash" replaces ".hash", and allows for more efficient runtime symbol lookups by the dynamic linker. The new ld option --hash-style={sysv|gnu|both} controls whether to produce the old ".hash", the new ".gnu.hash", or both. In some new systems such as Fedora Core 6, gcc by default passes --hash-style=gnu to the linker, so that a standard invocation of "gcc -shared" results in producing a DSO with only ".gnu.hash". The new ".gnu.hash" sections need to be dealt with the same way as ".hash" sections in all respects; only the dynamic linker cares about their contents. To work with older dynamic linkers (i.e. preexisting releases of glibc), a binary must have the old ".hash" section. The --hash-style=both option produces binaries that a new dynamic linker can use more efficiently, but an old dynamic linker can still handle. The new section runs afoul of the custom linker scripts used to build vDSO images for the kernel. On ia64, the failure mode for this is a boot-time panic because the vDSO's PT_IA_64_UNWIND segment winds up ill-formed. This patch addresses the problem in two ways. First, it mentions ".gnu.hash" in all the linker scripts alongside ".hash". This produces correct vDSO images with --hash-style=sysv (or old tools), with --hash-style=gnu, or with --hash-style=both. Second, it passes the --hash-style=sysv option when building the vDSO images, so that ".gnu.hash" is not actually produced. This is the most conservative choice for compatibility with any old userland. There is some concern that some ancient glibc builds (though not any known old production system) might choke on --hash-style=both binaries. The optimizations provided by the new style of hash section do not really matter for a DSO with a tiny number of symbols, as the vDSO has. If someone wants to use =gnu or =both for their vDSO builds and worry less about that compatibility, just change the option and the linker script changes will make any choice work fine. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Andi Kleen <ak@muc.de> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
86 lines
3.1 KiB
Makefile
86 lines
3.1 KiB
Makefile
#
|
|
# Makefile for the linux kernel.
|
|
#
|
|
|
|
extra-y := head.o init_task.o vmlinux.lds
|
|
|
|
obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
|
|
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
|
|
pci-dma.o i386_ksyms.o i387.o bootflag.o \
|
|
quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
|
|
|
|
obj-$(CONFIG_STACKTRACE) += stacktrace.o
|
|
obj-y += cpu/
|
|
obj-y += acpi/
|
|
obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o
|
|
obj-$(CONFIG_MCA) += mca.o
|
|
obj-$(CONFIG_X86_MSR) += msr.o
|
|
obj-$(CONFIG_X86_CPUID) += cpuid.o
|
|
obj-$(CONFIG_MICROCODE) += microcode.o
|
|
obj-$(CONFIG_APM) += apm.o
|
|
obj-$(CONFIG_X86_SMP) += smp.o smpboot.o
|
|
obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
|
|
obj-$(CONFIG_X86_MPPARSE) += mpparse.o
|
|
obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o
|
|
obj-$(CONFIG_X86_IO_APIC) += io_apic.o
|
|
obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o
|
|
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
|
|
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
|
|
obj-$(CONFIG_X86_NUMAQ) += numaq.o
|
|
obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
|
|
obj-$(CONFIG_KPROBES) += kprobes.o
|
|
obj-$(CONFIG_MODULES) += module.o
|
|
obj-y += sysenter.o vsyscall.o
|
|
obj-$(CONFIG_ACPI_SRAT) += srat.o
|
|
obj-$(CONFIG_HPET_TIMER) += time_hpet.o
|
|
obj-$(CONFIG_EFI) += efi.o efi_stub.o
|
|
obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
|
|
obj-$(CONFIG_VM86) += vm86.o
|
|
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
|
|
obj-$(CONFIG_HPET_TIMER) += hpet.o
|
|
obj-$(CONFIG_K8_NB) += k8.o
|
|
obj-$(CONFIG_AUDIT) += audit.o
|
|
|
|
EXTRA_AFLAGS := -traditional
|
|
|
|
obj-$(CONFIG_SCx200) += scx200.o
|
|
|
|
# vsyscall.o contains the vsyscall DSO images as __initdata.
|
|
# We must build both images before we can assemble it.
|
|
# Note: kbuild does not track this dependency due to usage of .incbin
|
|
$(obj)/vsyscall.o: $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so
|
|
targets += $(foreach F,int80 sysenter,vsyscall-$F.o vsyscall-$F.so)
|
|
targets += vsyscall-note.o vsyscall.lds
|
|
|
|
# The DSO images are built using a special linker script.
|
|
quiet_cmd_syscall = SYSCALL $@
|
|
cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
|
|
-Wl,-T,$(filter-out FORCE,$^) -o $@
|
|
|
|
export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH)
|
|
|
|
vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
|
|
$(call ld-option, -Wl$(comma)--hash-style=sysv)
|
|
SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
|
|
SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
|
|
|
|
$(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
|
|
$(obj)/vsyscall-%.so: $(src)/vsyscall.lds \
|
|
$(obj)/vsyscall-%.o $(obj)/vsyscall-note.o FORCE
|
|
$(call if_changed,syscall)
|
|
|
|
# We also create a special relocatable object that should mirror the symbol
|
|
# table and layout of the linked DSO. With ld -R we can then refer to
|
|
# these symbols in the kernel code rather than hand-coded addresses.
|
|
extra-y += vsyscall-syms.o
|
|
$(obj)/built-in.o: $(obj)/vsyscall-syms.o
|
|
$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
|
|
|
|
SYSCFLAGS_vsyscall-syms.o = -r
|
|
$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds \
|
|
$(obj)/vsyscall-sysenter.o $(obj)/vsyscall-note.o FORCE
|
|
$(call if_changed,syscall)
|
|
|
|
k8-y += ../../x86_64/kernel/k8.o
|
|
|