Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+16 -1
+4
arch/sparc/include/asm/thread_info_64.h
··· 121 121 } 122 122 123 123 /* how to get the thread information struct from C */ 124 + #ifndef BUILD_VDSO 124 125 register struct thread_info *current_thread_info_reg asm("g6"); 125 126 #define current_thread_info() (current_thread_info_reg) 127 + #else 128 + extern struct thread_info *current_thread_info(void); 129 + #endif 126 130 127 131 /* thread information allocation */ 128 132 #if PAGE_SHIFT == 13
+2 -1
arch/sparc/vdso/Makefile
··· 111 111 quiet_cmd_vdso = VDSO $@ 112 112 cmd_vdso = $(LD) -nostdlib -o $@ \ 113 113 $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ 114 - -T $(filter %.lds,$^) $(filter %.o,$^) 114 + -T $(filter %.lds,$^) $(filter %.o,$^) && \ 115 + sh $(srctree)/$(src)/checkundef.sh '$(OBJDUMP)' '$@' 115 116 116 117 VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \ 117 118 $(call ld-option, --build-id) -Bsymbolic
+10
arch/sparc/vdso/checkundef.sh
··· 1 + #!/bin/sh 2 + objdump="$1" 3 + file="$2" 4 + $objdump -t "$file" | grep '*UUND*' | grep -v '#scratch' > /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