summaryrefslogtreecommitdiff
path: root/arch/sparc/vdso
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-10-22 08:36:17 +0300
committerDavid S. Miller <davem@davemloft.net>2018-10-23 02:09:27 +0300
commitecd4c19f3df7f3687867a2183934efb54a7d3c14 (patch)
tree226bf19f76f3af813d5805bc53ddf1cf027b1a7f /arch/sparc/vdso
parent3c2b2d9408b11022614bf656ae56c8fc12001ecc (diff)
downloadlinux-ecd4c19f3df7f3687867a2183934efb54a7d3c14.tar.xz
sparc: Validate VDSO for undefined symbols.
There should be no undefined symbols in the resulting VDSO image(s). On sparc, fixed register usage can result in undefined symbols ending up in the image. To combat this, we do two things: 1) Define current_thread_info() specially when BUILD_DSO. 2) Ignore "#scratch" register undefined symbols in the output. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/vdso')
-rw-r--r--arch/sparc/vdso/Makefile3
-rw-r--r--arch/sparc/vdso/checkundef.sh10
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index a9e3a4f633a7..a6e18ca4cc18 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -111,7 +111,8 @@ $(obj)/vdso32.so.dbg: FORCE \
quiet_cmd_vdso = VDSO $@
cmd_vdso = $(LD) -nostdlib -o $@ \
$(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
- -T $(filter %.lds,$^) $(filter %.o,$^)
+ -T $(filter %.lds,$^) $(filter %.o,$^) && \
+ sh $(srctree)/$(src)/checkundef.sh '$(OBJDUMP)' '$@'
VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \
$(call ld-option, --build-id) -Bsymbolic
diff --git a/arch/sparc/vdso/checkundef.sh b/arch/sparc/vdso/checkundef.sh
new file mode 100644
index 000000000000..2d85876ffc32
--- /dev/null
+++ b/arch/sparc/vdso/checkundef.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+objdump="$1"
+file="$2"
+$objdump -t "$file" | grep '*UUND*' | grep -v '#scratch' > /dev/null 2>&1
+if [ $? -eq 1 ]; then
+ exit 0
+else
+ echo "$file: undefined symbols found" >&2
+ exit 1
+fi