/
0005-Fix-vdso-link-error.patch
45 lines (34 loc) · 2.19 KB
/
0005-Fix-vdso-link-error.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 53bfebec3659c0b2e5bd36abdddc075989c2c54b Mon Sep 17 00:00:00 2001
From: Matt Whitlock <foo@bar.org>
Date: Wed, 22 Nov 2017 08:31:16 +0100
Subject: [PATCH 5/5] Fix vdso link error
https://bugzilla.kernel.org/show_bug.cgi?id=187841
While executing the recipe for arch/x86/entry/vdso/vdsox32.so:
gcc -nostdlib -o arch/x86/entry/vdso/vdsox32.so.dbg -fPIC -shared -Wl,--hash-style=both -Wl,--build-id -Wl,-Bsymbolic -Wl,-m,elf32_x86_64 -Wl,-soname=linux-vdso.so.1 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 -Wl,-T,arch/x86/entry/vdso/vdsox32.lds arch/x86/entry/vdso/vdso-note-x32.o arch/x86/entry/vdso/vclock_gettime-x32.o arch/x86/entry/vdso/vgetcpu-x32.o && sh ./arch/x86/entry/vdso/checkundef.sh 'nm' 'arch/x86/entry/vdso/vdsox32.so.dbg'
arch/x86/entry/vdso/vclock_gettime-x32.o:vclock_gettime.c:function __vdso_clock_gettime: error: relocation overflow: reference to 'vvar_vsyscall_gtod_data'
arch/x86/entry/vdso/vclock_gettime-x32.o:vclock_gettime.c:function __vdso_gettimeofday: error: relocation overflow: reference to 'vvar_vsyscall_gtod_data'
arch/x86/entry/vdso/vclock_gettime-x32.o:vclock_gettime.c:function __vdso_time: error: relocation overflow: reference to 'vvar_vsyscall_gtod_data'
collect2: error: ld returned 1 exit status
This error causes the subsequent call to objcopy to fail, thus aborting the build.
objcopy -S arch/x86/entry/vdso/vdsox32.so.dbg arch/x86/entry/vdso/vdsox32.so
objcopy: 'arch/x86/entry/vdso/vdsox32.so.dbg': No such file
make[3]: *** [arch/x86/entry/vdso/Makefile:124: arch/x86/entry/vdso/vdsox32.so] Error 1
$ ld --version | head -n1
GNU gold (Gentoo 2.27 p1.0 2.27) 1.12
A workaround is to force usage of the BFD linker when linking the x32 VDSO:
---
arch/x86/entry/vdso/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index c366c0a..ed98851 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -98,6 +98,7 @@ CFLAGS_REMOVE_vvar.o = -pg
CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
VDSO_LDFLAGS_vdsox32.lds = -Wl,-m,elf32_x86_64 \
+ -fuse-ld=bfd \
-Wl,-soname=linux-vdso.so.1 \
-Wl,-z,max-page-size=4096 \
-Wl,-z,common-page-size=4096
--
2.9.3