diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2010-06-18 17:36:26 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-06-18 17:46:21 -0400 |
commit | 05d0b0889ca9d033a960542af7f8a13b3ad4f630 (patch) | |
tree | f77ab36957838f0a262ac6efab1201dd5b8f0593 /arch/x86/vdso | |
parent | 7e27d6e778cd87b6f2415515d7127eba53fe5d02 (diff) |
x86, vdso: Error out if the vdso contains external references
The vdso is a piece of userspace code which is supposed to be fully
self-contained. Any external (undefined) reference is an error, and
should be caught at compile time. This was giving us trouble when
compiling with -Os on gcc 4.5.0, for example (failed inline).
The need to do a buildtime check was pointed out by Andi Kleen.
Reported-by: Andi Kleen <andi@firstfloor.org>
LKML-Reference: <tip-*@vger.kernel.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/vdso')
-rw-r--r-- | arch/x86/vdso/Makefile | 3 | ||||
-rwxr-xr-x | arch/x86/vdso/checkundef.sh | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile index 6b4ffedb93c9..4a2afa1bac51 100644 --- a/arch/x86/vdso/Makefile +++ b/arch/x86/vdso/Makefile | |||
@@ -120,7 +120,8 @@ $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE | |||
120 | quiet_cmd_vdso = VDSO $@ | 120 | quiet_cmd_vdso = VDSO $@ |
121 | cmd_vdso = $(CC) -nostdlib -o $@ \ | 121 | cmd_vdso = $(CC) -nostdlib -o $@ \ |
122 | $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ | 122 | $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ |
123 | -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) | 123 | -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ |
124 | sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' | ||
124 | 125 | ||
125 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | 126 | VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) |
126 | GCOV_PROFILE := n | 127 | GCOV_PROFILE := n |
diff --git a/arch/x86/vdso/checkundef.sh b/arch/x86/vdso/checkundef.sh new file mode 100755 index 000000000000..490be1c38f94 --- /dev/null +++ b/arch/x86/vdso/checkundef.sh | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | nm="$1" | ||
3 | file="$2" | ||
4 | "$nm" "$file" | grep '^ *U' > /dev/null 2>&1 | ||
5 | if [ $? -eq 1 ]; then | ||
6 | exit 0 | ||
7 | else | ||
8 | echo "$file: undefined symbols found" >&2 | ||
9 | exit 1 | ||
10 | fi | ||