summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2017-11-20 11:41:07 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-12-13 10:51:35 +0100
commitbc3703f21cec8a2ac6a64f6fb3686fbcb1ba1513 (patch)
tree8afb21635860b1ba73e8d5be04536b626cbb338b
parenta5f1005517534aeb1fac20180badfbf0896c183c (diff)
downloadop-kernel-dev-bc3703f21cec8a2ac6a64f6fb3686fbcb1ba1513.zip
op-kernel-dev-bc3703f21cec8a2ac6a64f6fb3686fbcb1ba1513.tar.gz
s390/kernel: emit CFI data in .debug_frame and discard .eh_frame sections
Using perf probe and libdw on kernel modules failed to find CFI data for symbols. The CFI data is stored in the .eh_frame section. The elfutils libdw is not able to extract the CFI data correctly, because the .eh_frame section requires "non-simple" relocations for kernel modules. The suggestion is to avoid these "non-simple" relocations by emitting the CFI data in the .debug_frame section. Let gcc emit respective directives by specifying the -fno-asynchronous-unwind-tables option. Using the .debug_frame section for CFI data, the .eh_frame section becomes unused and, thus, discard it for kernel and modules builds The vDSO requires the .eh_frame section and, hence, emit the CFI data in both, the .eh_frame and .debug_frame sections. See also discussion on elfutils/libdw bugzilla: https://sourceware.org/bugzilla/show_bug.cgi?id=22452 Suggested-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/Makefile1
-rw-r--r--arch/s390/include/asm/dwarf.h25
-rw-r--r--arch/s390/kernel/vdso32/Makefile3
-rw-r--r--arch/s390/kernel/vdso32/clock_getres.S1
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S1
-rw-r--r--arch/s390/kernel/vdso32/getcpu.S1
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S1
-rw-r--r--arch/s390/kernel/vdso64/Makefile3
-rw-r--r--arch/s390/kernel/vdso64/clock_getres.S1
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S1
-rw-r--r--arch/s390/kernel/vdso64/getcpu.S1
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S1
-rw-r--r--arch/s390/kernel/vmlinux.lds.S3
13 files changed, 43 insertions, 0 deletions
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index de54cfc..494bb9a 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -90,6 +90,7 @@ endif
KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
+KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
KBUILD_AFLAGS += $(aflags-y)
OBJCOPYFLAGS := -O binary
diff --git a/arch/s390/include/asm/dwarf.h b/arch/s390/include/asm/dwarf.h
new file mode 100644
index 0000000..dffdb81
--- /dev/null
+++ b/arch/s390/include/asm/dwarf.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_S390_DWARF_H
+#define _ASM_S390_DWARF_H
+
+#ifdef __ASSEMBLY__
+
+#ifndef BUILD_VDSO
+ /*
+ * Emit CFI data in .debug_frame sections and not in .eh_frame
+ * sections. The .eh_frame CFI is used for runtime unwind
+ * information that is not being used. Hence, vmlinux.lds.S
+ * can discard the .eh_frame sections.
+ */
+ .cfi_sections .debug_frame
+#else
+ /*
+ * For vDSO, emit CFI data in both, .eh_frame and .debug_frame
+ * sections.
+ */
+ .cfi_sections .eh_frame, .debug_frame
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_S390_DWARF_H */
diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
index 308564b..c5c856f 100644
--- a/arch/s390/kernel/vdso32/Makefile
+++ b/arch/s390/kernel/vdso32/Makefile
@@ -10,6 +10,9 @@ obj-vdso32 = gettimeofday.o clock_getres.o clock_gettime.o note.o getcpu.o
targets := $(obj-vdso32) vdso32.so vdso32.so.dbg
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
+KBUILD_AFLAGS += -DBUILD_VDSO
+KBUILD_CFLAGS += -DBUILD_VDSO
+
KBUILD_AFLAGS_31 := $(filter-out -m64,$(KBUILD_AFLAGS))
KBUILD_AFLAGS_31 += -m31 -s
diff --git a/arch/s390/kernel/vdso32/clock_getres.S b/arch/s390/kernel/vdso32/clock_getres.S
index f61df52..6aeddf8 100644
--- a/arch/s390/kernel/vdso32/clock_getres.S
+++ b/arch/s390/kernel/vdso32/clock_getres.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 2d6ec3a..d0ac32c 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso32/getcpu.S b/arch/s390/kernel/vdso32/getcpu.S
index 5477a2c..539d92a 100644
--- a/arch/s390/kernel/vdso32/getcpu.S
+++ b/arch/s390/kernel/vdso32/getcpu.S
@@ -8,6 +8,7 @@
*/
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
index aa8bf13..435f819 100644
--- a/arch/s390/kernel/vdso32/gettimeofday.S
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index f81ae79..15b1cea 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -10,6 +10,9 @@ obj-vdso64 = gettimeofday.o clock_getres.o clock_gettime.o note.o getcpu.o
targets := $(obj-vdso64) vdso64.so vdso64.so.dbg
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
+KBUILD_AFLAGS += -DBUILD_VDSO
+KBUILD_CFLAGS += -DBUILD_VDSO
+
KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
KBUILD_AFLAGS_64 += -m64 -s
diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S
index faf5213..5b0d9c3 100644
--- a/arch/s390/kernel/vdso64/clock_getres.S
+++ b/arch/s390/kernel/vdso64/clock_getres.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 6046b3b..deccd79 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso64/getcpu.S b/arch/s390/kernel/vdso64/getcpu.S
index e9c3436..022acde 100644
--- a/arch/s390/kernel/vdso64/getcpu.S
+++ b/arch/s390/kernel/vdso64/getcpu.S
@@ -8,6 +8,7 @@
*/
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
index cc9dbc2..964afb1 100644
--- a/arch/s390/kernel/vdso64/gettimeofday.S
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -9,6 +9,7 @@
#include <asm/vdso.h>
#include <asm/asm-offsets.h>
#include <asm/unistd.h>
+#include <asm/dwarf.h>
.text
.align 4
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index a049ff0..608cf29 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -141,4 +141,7 @@ SECTIONS
/* Sections to be discarded */
DISCARDS
+ /DISCARD/ : {
+ *(.eh_frame)
+ }
}
OpenPOWER on IntegriCloud