Yet an other way to avoid configure error on LTO

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libsigsegv?expand=0&rev=20
This commit is contained in:
Dr. Werner Fink 2019-04-25 11:25:06 +00:00 committed by Git OBS Bridge
parent 520e3f4a24
commit 3bd6c62933
3 changed files with 345 additions and 2 deletions

332
libsigsegv-2.12-lto.dif Normal file
View File

@ -0,0 +1,332 @@
--- configure
+++ configure 2019-04-25 11:02:56.690127942 +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;
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
#include <signal.h>
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
void sigsegv_handler (int sig, struct sigcontext sc)
{
void *fault_address = (void *) (sc.cr2);
@@ -12718,7 +12722,9 @@ else
#if HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
#include <sys/types.h>
#include <sys/mman.h>
#if HAVE_MMAP_DEVZERO
@@ -12750,7 +12756,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;
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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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
#include <signal.h>
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
#include "$srcdir/src/fault-linux-m68k-old.c"
void sigsegv_handler (int sig, int code, struct sigcontext *scp)
{
@@ -13049,7 +13061,9 @@ else
#if HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
#include "$srcdir/src/fault-linux-m68k-old.c"
#include <sys/types.h>
#include <sys/mman.h>
@@ -13082,7 +13096,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;
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
#include <signal.h>
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
void sigsegv_handler (int sig, struct sigcontext *scp)
{
void *fault_address = (void *) (scp->regs->dar);
@@ -13215,7 +13233,9 @@ else
#if HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
+#ifndef _DEFAULT_SOURCE
#include <asm/sigcontext.h>
+#endif
#include <sys/types.h>
#include <sys/mman.h>
#if HAVE_MMAP_DEVZERO
@@ -13247,7 +13267,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;
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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+sig_atomic_t handler_called;
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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+sig_atomic_t handler_called;
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;
# define SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS 0UL
#endif
unsigned long page;
-int handler_called = 0;
+sig_atomic_t handler_called;
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);

View File

@ -1,8 +1,17 @@
-------------------------------------------------------------------
Thu Apr 25 11:18:04 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Add patch libsigsegv-2.12-lto.dif
* Avoid redefinition of structures of <bits/sigcontext.h> by
<asm/sigcontext.h>
* Avoid moved logic in resulting assembler code for LTO objects
in signal handler for segmentation faults
-------------------------------------------------------------------
Thu Apr 25 06:34:02 UTC 2019 - Dr. Werner Fink <werner@suse.de>
- Avoid none debugging libsigsegv, that is add -fno-lto (boo#1133245)
- Use %license is known
- Use %license if known
-------------------------------------------------------------------
Wed Apr 24 17:18:04 UTC 2019 - Martin Liška <mliska@suse.cz>

View File

@ -28,6 +28,7 @@ Url: https://www.gnu.org/software/libsigsegv/
Source0: https://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-%{version}.tar.gz
Source1: https://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-%{version}.tar.gz.sig
Source2: https://savannah.gnu.org/project/memberlist-gpgkeys.php?group=%{name}&download=1#/%{name}.keyring
Patch0: libsigsegv-2.12-lto.dif
BuildRequires: pkgconfig
%define add_optflags(a:f:t:p:w:W:d:g:O:A:C:D:E:H:i:M:n:P:U:u:l:s:X:B:I:L:b:V:m:x:c:S:E:o:v:) \
@ -68,10 +69,11 @@ available.
%prep
%setup -q
%patch0
%build
%define _lto_cflags %{nil}
%add_optflags -fno-lto -D_DEFAULT_SOURCE -D_XOPEN_SOURCE
%add_optflags -D_DEFAULT_SOURCE -D_XOPEN_SOURCE
%configure \
--enable-shared \
--enable-static