diff options
| -rw-r--r-- | Documentation/kbuild/makefiles.txt | 14 | ||||
| -rw-r--r-- | arch/i386/kernel/Makefile | 3 | ||||
| -rw-r--r-- | arch/i386/kernel/vsyscall.lds.S | 1 | ||||
| -rw-r--r-- | arch/ia64/kernel/Makefile | 3 | ||||
| -rw-r--r-- | arch/ia64/kernel/gate.lds.S | 1 | ||||
| -rw-r--r-- | arch/parisc/kernel/vmlinux.lds.S | 1 | ||||
| -rw-r--r-- | arch/powerpc/kernel/vdso32/Makefile | 3 | ||||
| -rw-r--r-- | arch/powerpc/kernel/vdso32/vdso32.lds.S | 1 | ||||
| -rw-r--r-- | arch/powerpc/kernel/vdso64/Makefile | 3 | ||||
| -rw-r--r-- | arch/powerpc/kernel/vdso64/vdso64.lds.S | 1 | ||||
| -rw-r--r-- | arch/ppc/kernel/vmlinux.lds.S | 1 | ||||
| -rw-r--r-- | arch/um/kernel/dyn.lds.S | 1 | ||||
| -rw-r--r-- | arch/x86_64/ia32/Makefile | 1 | ||||
| -rw-r--r-- | arch/x86_64/ia32/vsyscall.lds | 1 | ||||
| -rw-r--r-- | scripts/Kbuild.include | 7 |
15 files changed, 38 insertions, 4 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 14ef3868a328..0706699c9da9 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
| @@ -407,6 +407,20 @@ more details, with real examples. | |||
| 407 | The second argument is optional, and if supplied will be used | 407 | The second argument is optional, and if supplied will be used |
| 408 | if first argument is not supported. | 408 | if first argument is not supported. |
| 409 | 409 | ||
| 410 | ld-option | ||
| 411 | ld-option is used to check if $(CC) when used to link object files | ||
| 412 | supports the given option. An optional second option may be | ||
| 413 | specified if first option are not supported. | ||
| 414 | |||
| 415 | Example: | ||
| 416 | #arch/i386/kernel/Makefile | ||
| 417 | vsyscall-flags += $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
| 418 | |||
| 419 | In the above example vsyscall-flags will be assigned the option | ||
| 420 | -Wl$(comma)--hash-style=sysv if it is supported by $(CC). | ||
| 421 | The second argument is optional, and if supplied will be used | ||
| 422 | if first argument is not supported. | ||
| 423 | |||
| 410 | cc-option | 424 | cc-option |
| 411 | cc-option is used to check if $(CC) support a given option, and not | 425 | cc-option is used to check if $(CC) support a given option, and not |
| 412 | supported to use an optional second option. | 426 | supported to use an optional second option. |
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index 1b452a1665c4..ab98fc21a541 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile | |||
| @@ -59,7 +59,8 @@ quiet_cmd_syscall = SYSCALL $@ | |||
| 59 | 59 | ||
| 60 | export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH) | 60 | export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH) |
| 61 | 61 | ||
| 62 | vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 | 62 | vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ |
| 63 | $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
| 63 | SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags) | 64 | SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags) |
| 64 | SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) | 65 | SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) |
| 65 | 66 | ||
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S index e26975fc68b6..f66cd11adb72 100644 --- a/arch/i386/kernel/vsyscall.lds.S +++ b/arch/i386/kernel/vsyscall.lds.S | |||
| @@ -10,6 +10,7 @@ SECTIONS | |||
| 10 | . = VDSO_PRELINK + SIZEOF_HEADERS; | 10 | . = VDSO_PRELINK + SIZEOF_HEADERS; |
| 11 | 11 | ||
| 12 | .hash : { *(.hash) } :text | 12 | .hash : { *(.hash) } :text |
| 13 | .gnu.hash : { *(.gnu.hash) } | ||
| 13 | .dynsym : { *(.dynsym) } | 14 | .dynsym : { *(.dynsym) } |
| 14 | .dynstr : { *(.dynstr) } | 15 | .dynstr : { *(.dynstr) } |
| 15 | .gnu.version : { *(.gnu.version) } | 16 | .gnu.version : { *(.gnu.version) } |
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index 0e4553f320bf..ad8215a3c586 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile | |||
| @@ -45,7 +45,8 @@ CPPFLAGS_gate.lds := -P -C -U$(ARCH) | |||
| 45 | quiet_cmd_gate = GATE $@ | 45 | quiet_cmd_gate = GATE $@ |
| 46 | cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ | 46 | cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ |
| 47 | 47 | ||
| 48 | GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 | 48 | GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \ |
| 49 | $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
| 49 | $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE | 50 | $(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE |
| 50 | $(call if_changed,gate) | 51 | $(call if_changed,gate) |
| 51 | 52 | ||
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S index cc35cddfd4cf..6d198339bf85 100644 --- a/arch/ia64/kernel/gate.lds.S +++ b/arch/ia64/kernel/gate.lds.S | |||
| @@ -12,6 +12,7 @@ SECTIONS | |||
| 12 | . = GATE_ADDR + SIZEOF_HEADERS; | 12 | . = GATE_ADDR + SIZEOF_HEADERS; |
| 13 | 13 | ||
| 14 | .hash : { *(.hash) } :readable | 14 | .hash : { *(.hash) } :readable |
| 15 | .gnu.hash : { *(.gnu.hash) } | ||
| 15 | .dynsym : { *(.dynsym) } | 16 | .dynsym : { *(.dynsym) } |
| 16 | .dynstr : { *(.dynstr) } | 17 | .dynstr : { *(.dynstr) } |
| 17 | .gnu.version : { *(.gnu.version) } | 18 | .gnu.version : { *(.gnu.version) } |
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 9989495a51dd..b3677fc8eef5 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S | |||
| @@ -204,6 +204,7 @@ SECTIONS | |||
| 204 | *(.dynstr) | 204 | *(.dynstr) |
| 205 | *(.dynamic) | 205 | *(.dynamic) |
| 206 | *(.hash) | 206 | *(.hash) |
| 207 | *(.gnu.hash) | ||
| 207 | #endif | 208 | #endif |
| 208 | } | 209 | } |
| 209 | 210 | ||
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile index 8a3bed5f143a..3726358faae8 100644 --- a/arch/powerpc/kernel/vdso32/Makefile +++ b/arch/powerpc/kernel/vdso32/Makefile | |||
| @@ -14,7 +14,8 @@ obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32)) | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin | 16 | EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin |
| 17 | EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso32.so.1 | 17 | EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso32.so.1 \ |
| 18 | $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
| 18 | EXTRA_AFLAGS := -D__VDSO32__ -s | 19 | EXTRA_AFLAGS := -D__VDSO32__ -s |
| 19 | 20 | ||
| 20 | obj-y += vdso32_wrapper.o | 21 | obj-y += vdso32_wrapper.o |
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S index f4bad720cb0a..6187af2d54c3 100644 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S | |||
| @@ -14,6 +14,7 @@ SECTIONS | |||
| 14 | { | 14 | { |
| 15 | . = VDSO32_LBASE + SIZEOF_HEADERS; | 15 | . = VDSO32_LBASE + SIZEOF_HEADERS; |
| 16 | .hash : { *(.hash) } :text | 16 | .hash : { *(.hash) } :text |
| 17 | .gnu.hash : { *(.gnu.hash) } | ||
| 17 | .dynsym : { *(.dynsym) } | 18 | .dynsym : { *(.dynsym) } |
| 18 | .dynstr : { *(.dynstr) } | 19 | .dynstr : { *(.dynstr) } |
| 19 | .gnu.version : { *(.gnu.version) } | 20 | .gnu.version : { *(.gnu.version) } |
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile index ab39988452cc..43af9b2a6f3b 100644 --- a/arch/powerpc/kernel/vdso64/Makefile +++ b/arch/powerpc/kernel/vdso64/Makefile | |||
| @@ -8,7 +8,8 @@ targets := $(obj-vdso64) vdso64.so | |||
| 8 | obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) | 8 | obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) |
| 9 | 9 | ||
| 10 | EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin | 10 | EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin |
| 11 | EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 | 11 | EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 \ |
| 12 | $(call ld-option, -Wl$(comma)--hash-style=sysv) | ||
| 12 | EXTRA_AFLAGS := -D__VDSO64__ -s | 13 | EXTRA_AFLAGS := -D__VDSO64__ -s |
| 13 | 14 | ||
| 14 | obj-y += vdso64_wrapper.o | 15 | obj-y += vdso64_wrapper.o |
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S index 4bdf224464ab..4a2b6dc0960c 100644 --- a/arch/powerpc/kernel/vdso64/vdso64.lds.S +++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S | |||
| @@ -12,6 +12,7 @@ SECTIONS | |||
| 12 | { | 12 | { |
| 13 | . = VDSO64_LBASE + SIZEOF_HEADERS; | 13 | . = VDSO64_LBASE + SIZEOF_HEADERS; |
| 14 | .hash : { *(.hash) } :text | 14 | .hash : { *(.hash) } :text |
| 15 | .gnu.hash : { *(.gnu.hash) } | ||
| 15 | .dynsym : { *(.dynsym) } | 16 | .dynsym : { *(.dynsym) } |
| 16 | .dynstr : { *(.dynstr) } | 17 | .dynstr : { *(.dynstr) } |
| 17 | .gnu.version : { *(.gnu.version) } | 18 | .gnu.version : { *(.gnu.version) } |
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S index 09c6525cfa61..095fd3323323 100644 --- a/arch/ppc/kernel/vmlinux.lds.S +++ b/arch/ppc/kernel/vmlinux.lds.S | |||
| @@ -8,6 +8,7 @@ SECTIONS | |||
| 8 | . = + SIZEOF_HEADERS; | 8 | . = + SIZEOF_HEADERS; |
| 9 | .interp : { *(.interp) } | 9 | .interp : { *(.interp) } |
| 10 | .hash : { *(.hash) } | 10 | .hash : { *(.hash) } |
| 11 | .gnu.hash : { *(.gnu.hash) } | ||
| 11 | .dynsym : { *(.dynsym) } | 12 | .dynsym : { *(.dynsym) } |
| 12 | .dynstr : { *(.dynstr) } | 13 | .dynstr : { *(.dynstr) } |
| 13 | .rel.text : { *(.rel.text) } | 14 | .rel.text : { *(.rel.text) } |
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S index 2517ecb8bf27..68ed24df5c8f 100644 --- a/arch/um/kernel/dyn.lds.S +++ b/arch/um/kernel/dyn.lds.S | |||
| @@ -26,6 +26,7 @@ SECTIONS | |||
| 26 | 26 | ||
| 27 | /* Read-only sections, merged into text segment: */ | 27 | /* Read-only sections, merged into text segment: */ |
| 28 | .hash : { *(.hash) } | 28 | .hash : { *(.hash) } |
| 29 | .gnu.hash : { *(.gnu.hash) } | ||
| 29 | .dynsym : { *(.dynsym) } | 30 | .dynsym : { *(.dynsym) } |
| 30 | .dynstr : { *(.dynstr) } | 31 | .dynstr : { *(.dynstr) } |
| 31 | .gnu.version : { *(.gnu.version) } | 32 | .gnu.version : { *(.gnu.version) } |
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile index 62bc5f56da9e..cdae36435e21 100644 --- a/arch/x86_64/ia32/Makefile +++ b/arch/x86_64/ia32/Makefile | |||
| @@ -23,6 +23,7 @@ targets := $(foreach F,sysenter syscall,vsyscall-$F.o vsyscall-$F.so) | |||
| 23 | # The DSO images are built using a special linker script | 23 | # The DSO images are built using a special linker script |
| 24 | quiet_cmd_syscall = SYSCALL $@ | 24 | quiet_cmd_syscall = SYSCALL $@ |
| 25 | cmd_syscall = $(CC) -m32 -nostdlib -shared -s \ | 25 | cmd_syscall = $(CC) -m32 -nostdlib -shared -s \ |
| 26 | $(call ld-option, -Wl$(comma)--hash-style=sysv) \ | ||
| 26 | -Wl,-soname=linux-gate.so.1 -o $@ \ | 27 | -Wl,-soname=linux-gate.so.1 -o $@ \ |
| 27 | -Wl,-T,$(filter-out FORCE,$^) | 28 | -Wl,-T,$(filter-out FORCE,$^) |
| 28 | 29 | ||
diff --git a/arch/x86_64/ia32/vsyscall.lds b/arch/x86_64/ia32/vsyscall.lds index f2e75ed4c6c7..1dc86ff5bcb9 100644 --- a/arch/x86_64/ia32/vsyscall.lds +++ b/arch/x86_64/ia32/vsyscall.lds | |||
| @@ -11,6 +11,7 @@ SECTIONS | |||
| 11 | . = VSYSCALL_BASE + SIZEOF_HEADERS; | 11 | . = VSYSCALL_BASE + SIZEOF_HEADERS; |
| 12 | 12 | ||
| 13 | .hash : { *(.hash) } :text | 13 | .hash : { *(.hash) } :text |
| 14 | .gnu.hash : { *(.gnu.hash) } | ||
| 14 | .dynsym : { *(.dynsym) } | 15 | .dynsym : { *(.dynsym) } |
| 15 | .dynstr : { *(.dynstr) } | 16 | .dynstr : { *(.dynstr) } |
| 16 | .gnu.version : { *(.gnu.version) } | 17 | .gnu.version : { *(.gnu.version) } |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 2180c88cfe89..f01132263535 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -85,6 +85,13 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ | |||
| 85 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | 85 | cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ |
| 86 | echo $(3); fi;) | 86 | echo $(3); fi;) |
| 87 | 87 | ||
| 88 | # ld-option | ||
| 89 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | ||
| 90 | ld-option = $(shell if $(CC) $(1) \ | ||
| 91 | -nostdlib -o ldtest$$$$.out -xc /dev/null \ | ||
| 92 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi; \ | ||
| 93 | rm -f ldtest$$$$.out) | ||
| 94 | |||
| 88 | ### | 95 | ### |
| 89 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | 96 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= |
| 90 | # Usage: | 97 | # Usage: |
