From f004738409b8988d13d5cc565b3de567bf641043465395eb00bbb3fa8105dfd2 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 26 Apr 2019 11:20:58 +0000 Subject: [PATCH] Fat LTO objects OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libsigsegv?expand=0&rev=21 --- libsigsegv-2.12-lto.dif | 211 ++++++++-------------------------------- libsigsegv.changes | 5 + libsigsegv.spec | 14 ++- 3 files changed, 56 insertions(+), 174 deletions(-) diff --git a/libsigsegv-2.12-lto.dif b/libsigsegv-2.12-lto.dif index 8789a2b..f9b6ba9 100644 --- a/libsigsegv-2.12-lto.dif +++ b/libsigsegv-2.12-lto.dif @@ -1,24 +1,19 @@ +--- + configure | 42 +++++++++++++++++++++++++++--------------- + 1 file changed, 27 insertions(+), 15 deletions(-) + --- configure -+++ configure 2019-04-25 11:02:56.690127942 +0000 ++++ configure 2019-04-25 13:27:06.323370748 +0000 @@ -12587,7 +12587,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, siginfo_t *sip, void *ucp) { void *fault_address = (void *) (sip->si_addr); -@@ -12642,6 +12642,8 @@ action.sa_sigaction = &sigsegv_handler; - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -12683,7 +12685,9 @@ else +@@ -12683,7 +12683,9 @@ else #include @@ -28,7 +23,7 @@ void sigsegv_handler (int sig, struct sigcontext sc) { void *fault_address = (void *) (sc.cr2); -@@ -12718,7 +12722,9 @@ else +@@ -12718,7 +12720,9 @@ else #if HAVE_SYS_SIGNAL_H # include #endif @@ -38,43 +33,25 @@ #include #include #if HAVE_MMAP_DEVZERO -@@ -12750,7 +12756,7 @@ static int zero_fd; +@@ -12750,7 +12754,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, struct sigcontext sc) { void *fault_address = (void *) (sc.cr2); -@@ -12807,6 +12813,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -12915,7 +12923,7 @@ static int zero_fd; +@@ -12915,7 +12919,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, unsigned int more) { void *fault_address = (void *) (((unsigned long *) &more) [21]); -@@ -12972,6 +12980,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13013,7 +13023,9 @@ else +@@ -13013,7 +13017,9 @@ else #include @@ -84,7 +61,7 @@ #include "$srcdir/src/fault-linux-m68k-old.c" void sigsegv_handler (int sig, int code, struct sigcontext *scp) { -@@ -13049,7 +13061,9 @@ else +@@ -13049,7 +13055,9 @@ else #if HAVE_SYS_SIGNAL_H # include #endif @@ -94,25 +71,16 @@ #include "$srcdir/src/fault-linux-m68k-old.c" #include #include -@@ -13082,7 +13096,7 @@ static int zero_fd; +@@ -13082,7 +13090,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (get_fault_addr (scp)); -@@ -13139,6 +13153,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13180,7 +13196,9 @@ else +@@ -13180,7 +13188,9 @@ else #include @@ -122,7 +90,7 @@ void sigsegv_handler (int sig, struct sigcontext *scp) { void *fault_address = (void *) (scp->regs->dar); -@@ -13215,7 +13233,9 @@ else +@@ -13215,7 +13225,9 @@ else #if HAVE_SYS_SIGNAL_H # include #endif @@ -132,201 +100,102 @@ #include #include #if HAVE_MMAP_DEVZERO -@@ -13247,7 +13267,7 @@ static int zero_fd; +@@ -13247,7 +13259,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, struct sigcontext *scp) { void *fault_address = (void *) (scp->regs->dar); -@@ -13304,6 +13324,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13413,7 +13435,7 @@ static int zero_fd; +@@ -13413,7 +13425,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, siginfo_t *sip, void *ucp) { void *fault_address = (void *) (sip->si_ptr); -@@ -13468,6 +13490,8 @@ action.sa_sigaction = &sigsegv_handler; - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13576,7 +13600,7 @@ static int zero_fd; +@@ -13576,7 +13588,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp, void *addr) { void *fault_address = (void *) (addr); -@@ -13633,6 +13657,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13741,7 +13767,7 @@ static int zero_fd; +@@ -13741,7 +13753,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) ((unsigned long) scp->sc_badvaddr); -@@ -13798,6 +13824,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -13916,7 +13944,7 @@ static int zero_fd; +@@ -13916,7 +13928,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (GET_CR21 (scp->sc_sl.sl_ss)); -@@ -13974,6 +14002,8 @@ int main () - /* The second write access should not invoke the handler. */ - crasher (page); - /* Check that the handler was called only once. */ -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - if (handler_called != 1) - exit (1); - /* Test passed! */ -@@ -14081,7 +14111,7 @@ static int zero_fd; +@@ -14081,7 +14093,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (scp->sc_traparg_a0); -@@ -14138,6 +14168,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -14246,7 +14278,7 @@ static int zero_fd; +@@ -14246,7 +14258,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (get_fault_addr (scp)); -@@ -14303,6 +14335,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -14411,7 +14445,7 @@ static int zero_fd; +@@ -14411,7 +14423,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called = 0; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (scp->sc_jmpbuf.jmp_context.o_vaddr); -@@ -14468,6 +14502,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -14577,7 +14613,7 @@ static int zero_fd; +@@ -14577,7 +14589,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, siginfo_t *sip, ucontext_t *ucp) { void *fault_address = (void *) (get_fault_addr (sip, ucp)); -@@ -14632,6 +14668,8 @@ action.sa_sigaction = &sigsegv_handler; - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -14741,7 +14779,7 @@ static int zero_fd; +@@ -14741,7 +14753,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (get_fault_addr (scp)); -@@ -14798,6 +14836,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); -@@ -14907,7 +14947,7 @@ static int zero_fd; +@@ -14907,7 +14919,7 @@ static int zero_fd; # define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL #endif unsigned long page; -int handler_called = 0; -+sig_atomic_t handler_called; ++volatile sig_atomic_t handler_called = 0; void sigsegv_handler (int sig, int code, struct sigcontext *scp) { void *fault_address = (void *) (code); -@@ -14964,6 +15004,8 @@ int main () - crasher (page); - /* The second write access should not invoke the handler. */ - crasher (page); -+ /* LTO may move resulting assembler code around */ -+ __asm__ __volatile__("": : :"memory"); - /* Check that the handler was called only once. */ - if (handler_called != 1) - exit (1); diff --git a/libsigsegv.changes b/libsigsegv.changes index 6db3ec2..8e42c0b 100644 --- a/libsigsegv.changes +++ b/libsigsegv.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 26 11:19:16 UTC 2019 - Dr. Werner Fink + +- Allow LTO but only FAT LTO OBJECTS (boo#1133245) + ------------------------------------------------------------------- Thu Apr 25 11:18:04 UTC 2019 - Dr. Werner Fink diff --git a/libsigsegv.spec b/libsigsegv.spec index b26e50f..9dd6d2b 100644 --- a/libsigsegv.spec +++ b/libsigsegv.spec @@ -69,14 +69,22 @@ available. %prep %setup -q -%patch0 +%patch0 -b .p0 %build -%define _lto_cflags %{nil} -%add_optflags -D_DEFAULT_SOURCE -D_XOPEN_SOURCE +%add_optflags -g3 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE +%if 0%(case "%optflags" in (*-flto*) echo 1;; esac) +%global optflags %(echo -n "%optflags" | sed -r "s@-flto@-ffat-lto-objects@") +%endif %configure \ + --with-gnu-ld \ --enable-shared \ --enable-static +sed -ri 's@^((old_striplib|striplib)=)".*"@\1""@' libtool +sed -ri 's@^(hardcode_libdir_flag_spec=)".*"@\1""@' libtool +mkdir bin/ +ln -sf /bin/true bin/strip +PATH=${PWD}/bin:$PATH; export PATH make %{?_smp_mflags} %install