diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2017-09-14 12:47:35 +0100 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2017-09-19 15:07:58 +0100 |
commit | ca3a382ea3aa9c9ccb57060afae47c7f702727ac (patch) | |
tree | 53dbe1397c04c1ee52a024bd4193e1119b625df7 | |
parent | eb375def3ddd2a1738ed6bc5ace98753f0f7e5e6 (diff) | |
download | glibc-ca3a382ea3aa9c9ccb57060afae47c7f702727ac.zip glibc-ca3a382ea3aa9c9ccb57060afae47c7f702727ac.tar.gz glibc-ca3a382ea3aa9c9ccb57060afae47c7f702727ac.tar.bz2 |
Enable unwind info in libc-start.c and backtrace.c
Add unwind info to __libc_start_main so that unwinding continues one
extra level to _start. Similarly add unwind info to backtrace.
Given many targets require this, do this in a general way.
* csu/Makefile: Add -funwind-tables to libc-start.c.
* debug/Makefile: Add -funwind-tables to backtrace.c.
* sysdeps/aarch64/Makefile: Remove CFLAGS-backtrace.c.
* sysdeps/arm/Makefile: Likewise.
* sysdeps/i386/Makefile: Likewise.
* sysdeps/m68k/Makefile: Likewise.
* sysdeps/mips/Makefile: Likewise.
* sysdeps/nios2/Makefile: Likewise.
* sysdeps/sh/Makefile: Likewise.
* sysdeps/sparc/Makefile: Likewise.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | csu/Makefile | 3 | ||||
-rw-r--r-- | debug/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/aarch64/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/arm/Makefile | 9 | ||||
-rw-r--r-- | sysdeps/i386/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/m68k/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/mips/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/nios2/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/sh/Makefile | 4 | ||||
-rw-r--r-- | sysdeps/sparc/Makefile | 4 |
11 files changed, 17 insertions, 38 deletions
@@ -1,3 +1,16 @@ +2017-09-19 Wilco Dijkstra <wdijkstr@arm.com> + + * csu/Makefile: Add -funwind-tables to libc-start.c. + * debug/Makefile: Add -funwind-tables to backtrace.c. + * sysdeps/aarch64/Makefile: Remove CFLAGS-backtrace.c. + * sysdeps/arm/Makefile: Likewise. + * sysdeps/i386/Makefile: Likewise. + * sysdeps/m68k/Makefile: Likewise. + * sysdeps/mips/Makefile: Likewise. + * sysdeps/nios2/Makefile: Likewise. + * sysdeps/sh/Makefile: Likewise. + * sysdeps/sparc/Makefile: Likewise. + 2017-09-19 Joseph Myers <joseph@codesourcery.com> * benchtests/Makefile (bench-math): Add trunc and truncf. diff --git a/csu/Makefile b/csu/Makefile index 88646b6..490d0b0 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -82,6 +82,9 @@ extra-objs += $(crtstuff:=.o) extra-objs += abi-note.o init.o asm-CPPFLAGS += -I$(objpfx). +# Enable unwinding so backtrace unwinds to __libc_start_main +CFLAGS-libc-start.c += -funwind-tables + include ../Rules # Make these in the lib pass so they're available in time to link things with. diff --git a/debug/Makefile b/debug/Makefile index 504bf87..a9ac779 100644 --- a/debug/Makefile +++ b/debug/Makefile @@ -63,7 +63,7 @@ elide-routines.o := stack_chk_fail_local CFLAGS-stack_chk_fail.c = $(no-stack-protector) CFLAGS-stack_chk_fail_local.c = $(no-stack-protector) -CFLAGS-backtrace.c = -fno-omit-frame-pointer +CFLAGS-backtrace.c = -fno-omit-frame-pointer -funwind-tables CFLAGS-sprintf_chk.c = $(libio-mtsafe) CFLAGS-snprintf_chk.c = $(libio-mtsafe) CFLAGS-vsprintf_chk.c = $(libio-mtsafe) diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 562c137..5f3e203 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,9 +1,5 @@ long-double-fcts = yes -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif - ifeq ($(subdir),elf) sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile index 2849aed..ad2042b 100644 --- a/sysdeps/arm/Makefile +++ b/sysdeps/arm/Makefile @@ -51,11 +51,6 @@ sysdep_routines += $(aeabi_constants) $(aeabi_routines) static-only-routines += $(aeabi_constants) aeabi_read_tp shared-only-routines += libc-aeabi_read_tp -# In order for unwinding to fail when it falls out of main, we need a -# cantunwind marker. There's one in start.S. To make sure we reach it, add -# unwind tables for __libc_start_main. -CFLAGS-libc-start.c += -fexceptions - sysdep_routines += arm-unwind-resume shared-only-routines += arm-unwind-resume endif @@ -64,10 +59,6 @@ ifeq ($(subdir),gmon) sysdep_routines += arm-mcount endif -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif - ifeq ($(subdir),rt) librt-sysdep_routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume librt-shared-only-routines += rt-aeabi_unwind_cpp_pr1 rt-arm-unwind-resume diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile index e30e133..a150045 100644 --- a/sysdeps/i386/Makefile +++ b/sysdeps/i386/Makefile @@ -19,10 +19,6 @@ CFLAGS-dl-load.c += -Wno-unused CFLAGS-dl-reloc.c += -Wno-unused endif -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -fexceptions -endif - # Most of the glibc routines don't ever call user defined callbacks # nor use any FPU or SSE* and as such don't need bigger %esp alignment # than 4 bytes. diff --git a/sysdeps/m68k/Makefile b/sysdeps/m68k/Makefile index 26539fa..b691001 100644 --- a/sysdeps/m68k/Makefile +++ b/sysdeps/m68k/Makefile @@ -40,10 +40,6 @@ ifeq ($(subdir),setjmp) CFLAGS-setjmp.c := -fno-omit-frame-pointer endif -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif - ifeq ($(subdir),elf) CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused endif diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile index 7c1d779..fd891dd 100644 --- a/sysdeps/mips/Makefile +++ b/sysdeps/mips/Makefile @@ -12,10 +12,6 @@ librt-sysdep_routines += rt-sysdep librt-shared-only-routines += rt-sysdep endif -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif - ifeq ($(subdir),csu) CPPFLAGS-crti.S += $(pic-ccflag) CPPFLAGS-crtn.S += $(pic-ccflag) diff --git a/sysdeps/nios2/Makefile b/sysdeps/nios2/Makefile index 75cab5e..9ceab11 100644 --- a/sysdeps/nios2/Makefile +++ b/sysdeps/nios2/Makefile @@ -29,7 +29,3 @@ endif ifeq ($(subdir),csu) gen-as-const-headers += tcb-offsets.sym endif - -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif diff --git a/sysdeps/sh/Makefile b/sysdeps/sh/Makefile index 0c6db9a..de8fa0b 100644 --- a/sysdeps/sh/Makefile +++ b/sysdeps/sh/Makefile @@ -5,7 +5,3 @@ endif ifeq ($(subdir),gmon) sysdep_routines += _mcount endif - -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile index 31aaeae..3f0c096 100644 --- a/sysdeps/sparc/Makefile +++ b/sysdeps/sparc/Makefile @@ -3,10 +3,6 @@ long-double-fcts = yes pie-ccflag = -fPIE -ifeq ($(subdir),debug) -CFLAGS-backtrace.c += -funwind-tables -endif - ifeq ($(subdir),gmon) sysdep_routines += sparc-mcount endif |