* [PATCH 0/2] Clang inspired fixes
@ 2016-02-29 19:41 Khem Raj
2016-02-29 19:41 ` [PATCH 1/2] ghostscript: 9.16 -> 9.18 Khem Raj
2016-02-29 19:41 ` [PATCH 2/2] strace: Backport fixes for compiling with clang Khem Raj
0 siblings, 2 replies; 3+ messages in thread
From: Khem Raj @ 2016-02-29 19:41 UTC (permalink / raw)
To: openembedded-core
Trying to get OE-Core built using clang came up with
some errors which could be fixed with updating to newer
revision or backporting some of upstreamed patches
Hongxu Jia (1):
ghostscript: 9.16 -> 9.18
Khem Raj (1):
strace: Backport fixes for compiling with clang
...01-Move-gcc-compat-macros-to-gcc_compat.h.patch | 176 ++++++++++++
...1-scm_rights-fd.test-rewrite-without-fork.patch | 198 +++++++++++++
.../strace/0001-tests-introduce-libtests.patch | 306 +++++++++++++++++++++
.../0001-tests-scm_rights.c-use-libtests.patch | 54 ++++
meta/recipes-devtools/strace/strace_4.11.bb | 4 +
...Fix-support-for-building-with-no-jbig2-de.patch | 81 ++++++
...part-2-fix-support-for-building-with-a-JP.patch | 48 ++++
.../files/do-not-check-local-libpng-source.patch | 38 +++
.../{ghostscript_9.16.bb => ghostscript_9.18.bb} | 11 +-
9 files changed, 912 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch
create mode 100644 meta/recipes-extended/ghostscript/files/0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch
create mode 100644 meta/recipes-extended/ghostscript/files/0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch
create mode 100644 meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch
rename meta/recipes-extended/ghostscript/{ghostscript_9.16.bb => ghostscript_9.18.bb} (87%)
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ghostscript: 9.16 -> 9.18
2016-02-29 19:41 [PATCH 0/2] Clang inspired fixes Khem Raj
@ 2016-02-29 19:41 ` Khem Raj
2016-02-29 19:41 ` [PATCH 2/2] strace: Backport fixes for compiling with clang Khem Raj
1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2016-02-29 19:41 UTC (permalink / raw)
To: openembedded-core
From: Hongxu Jia <hongxu.jia@windriver.com>
- Backport patches to fix build failure caused by
'--without-jbig2dec' and '--without-jbig2dec'.
...
|make[1]: *** No rule to make target `obj/sjbig2_.dev',
needed by `obj/sjbig2.dev'. Stop.
...
http://bugs.ghostscript.com/show_bug.cgi?id=696497
- Previously, it did not build the whole local libpng
source in ghostscript, only picked up specific files
and compile them. But on ghostscript 9.18, when the
arm's FPU has been set to NEON (-mfpu=neon * with GCC),
the selected file "libpng/pngrutil.c" needs to link
'png_init_filter_functions_neon' which should be
compiled by a non-selected file "libpng/arm/arm_init.c".
...
|./obj/pngrutil.o: In function `png_init_filter_functions':
|armv7a-neon-poky-linux-gnueabi/ghostscript/9.18-r0/build/../
ghostscript-9.18/libpng/pngrutil.c:3921: undefined reference to
`png_init_filter_functions_neon'
...
So do not compile local libpng source in ghostscript,
use shared libpng to instead.
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...Fix-support-for-building-with-no-jbig2-de.patch | 81 ++++++++++++++++++++++
...part-2-fix-support-for-building-with-a-JP.patch | 48 +++++++++++++
.../files/do-not-check-local-libpng-source.patch | 38 ++++++++++
.../{ghostscript_9.16.bb => ghostscript_9.18.bb} | 11 +--
4 files changed, 174 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-extended/ghostscript/files/0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch
create mode 100644 meta/recipes-extended/ghostscript/files/0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch
create mode 100644 meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch
rename meta/recipes-extended/ghostscript/{ghostscript_9.16.bb => ghostscript_9.18.bb} (87%)
diff --git a/meta/recipes-extended/ghostscript/files/0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch b/meta/recipes-extended/ghostscript/files/0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch
new file mode 100644
index 0000000..d586a1d
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/files/0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch
@@ -0,0 +1,81 @@
+From 1d19998091154f89b8294e4594a05986b4c2f822 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Wed, 13 Jan 2016 02:08:42 -0500
+Subject: [PATCH 1/2] Bug 696497: Fix support for building with no jbig2
+ decoder
+
+Author: Chris Liddell <chris.liddell@artifex.com>
+
+Upstream-Status: Backport
+http://bugs.ghostscript.com/show_bug.cgi?id=696497
+http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=b0f5a975
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ base/lib.mak | 9 +++++++++
+ psi/int.mak | 23 ++++++++++++++++++-----
+ 2 files changed, 27 insertions(+), 5 deletions(-)
+
+diff --git a/base/lib.mak b/base/lib.mak
+index 241df2f..daa7056 100644
+--- a/base/lib.mak
++++ b/base/lib.mak
+@@ -1732,6 +1732,10 @@ $(GLD)sjbig2_jbig2dec.dev : $(LIB_MAK) $(ECHOGS_XE) \
+ $(SETMOD) $(GLD)sjbig2_jbig2dec $(sjbig2_jbig2dec)
+ $(ADDMOD) $(GLD)sjbig2_jbig2dec -include $(GLD)jbig2dec.dev
+
++$(GLD)sjbig2_.dev : $(LIB_MAK) $(ECHOGS_XE) \
++ $(LIB_MAK) $(MAKEDIRS)
++ $(SETMOD) $(GLD)sjbig2_
++
+ # jbig2dec.dev is defined in jbig2.mak
+
+ $(GLOBJ)sjbig2.$(OBJ) : $(GLSRC)sjbig2.c $(AK) \
+@@ -1739,6 +1743,11 @@ $(GLOBJ)sjbig2.$(OBJ) : $(GLSRC)sjbig2.c $(AK) \
+ $(sjbig2_h) $(strimpl_h) $(MAKEDIRS)
+ $(GLJBIG2CC) $(GLO_)sjbig2.$(OBJ) $(C_) $(GLSRC)sjbig2.c
+
++$(GLOBJ)snojbig2.$(OBJ) : $(GLSRC)snojbig2.c $(AK) \
++ $(stdint__h) $(memory__h) $(stdio__h) $(gserrors_h) $(gdebug_h) \
++ $(strimpl_h) $(LIB_MAK) $(MAKEDIRS)
++ $(GLJBIG2CC) $(GLO_)snojbig2.$(OBJ) $(C_) $(GLSRC)snojbig2.c
++
+ # luratech version
+ sjbig2_luratech=$(GLOBJ)sjbig2_luratech.$(OBJ)
+
+diff --git a/psi/int.mak b/psi/int.mak
+index 6149a3b..f9d667d 100644
+--- a/psi/int.mak
++++ b/psi/int.mak
+@@ -1254,11 +1254,24 @@ $(PSOBJ)zfaes.$(OBJ) : $(PSSRC)zfaes.c $(OP) $(memory__h)\
+ # this can be turned on and off with a FEATURE_DEV
+
+ fjbig2_=$(PSOBJ)zfjbig2_$(JBIG2_LIB).$(OBJ)
+-$(PSD)jbig2.dev : $(INT_MAK) $(ECHOGS_XE) $(fjbig2_) $(GLD)sjbig2.dev\
+- $(MAKEDIRS)
+- $(SETMOD) $(PSD)jbig2 $(fjbig2_)
+- $(ADDMOD) $(PSD)jbig2 -include $(GLD)sjbig2
+- $(ADDMOD) $(PSD)jbig2 -oper zfjbig2
++
++$(PSD)jbig2_jbig2dec.dev : $(ECHOGS_XE) $(fjbig2_) $(GLD)sjbig2.dev\
++ $(INT_MAK) $(MAKEDIRS)
++ $(SETMOD) $(PSD)jbig2_jbig2dec $(fjbig2_)
++ $(ADDMOD) $(PSD)jbig2_jbig2dec -include $(GLD)sjbig2
++ $(ADDMOD) $(PSD)jbig2_jbig2dec -oper zfjbig2
++
++$(PSD)jbig2_luratech.dev : $(ECHOGS_XE) $(fjbig2_) $(GLD)sjbig2.dev\
++ $(INT_MAK) $(MAKEDIRS)
++ $(SETMOD) $(PSD)jbig2_luratech $(fjbig2_)
++ $(ADDMOD) $(PSD)jbig2_luratech -include $(GLD)sjbig2
++ $(ADDMOD) $(PSD)jbig2_luratech -oper zfjbig2
++
++$(PSD)jbig2_.dev : $(ECHOGS_XE) $(INT_MAK) $(MAKEDIRS)
++ $(SETMOD) $(PSD)jbig2_
++
++$(PSD)jbig2.dev : $(PSD)jbig2_$(JBIG2_LIB).dev $(INT_MAK) $(MAKEDIRS)
++ $(CP_) $(PSD)jbig2_$(JBIG2_LIB).dev $(PSD)jbig2.dev
+
+ $(PSOBJ)zfjbig2_jbig2dec.$(OBJ) : $(PSSRC)zfjbig2.c $(OP) $(memory__h)\
+ $(gsstruct_h) $(gstypes_h) $(ialloc_h) $(idict_h) $(ifilter_h)\
+--
+1.9.1
+
diff --git a/meta/recipes-extended/ghostscript/files/0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch b/meta/recipes-extended/ghostscript/files/0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch
new file mode 100644
index 0000000..fcfc479
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/files/0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch
@@ -0,0 +1,48 @@
+From 3b43f93ec02611c4d554612953f5b64765b8683b Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Wed, 13 Jan 2016 02:14:55 -0500
+Subject: [PATCH 2/2] Bug 696497 (part 2): fix support for building with a JPX
+ decoder
+
+Author: Chris Liddell <chris.liddell@artifex.com>
+
+Upstream-Status: Backport
+http://bugs.ghostscript.com/show_bug.cgi?id=696497
+http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=b0f5a975
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ base/lib.mak | 3 +++
+ psi/int.mak | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/base/lib.mak b/base/lib.mak
+index daa7056..8853dd5 100644
+--- a/base/lib.mak
++++ b/base/lib.mak
+@@ -1774,6 +1774,9 @@ $(GLOBJ)sjpx.$(OBJ) : $(GLSRC)sjpx.c $(AK) \
+ $(gdebug_h) $(strimpl_h) $(sjpx_h) $(MAKEDIRS)
+ $(GLJASCC) $(GLO_)sjpx.$(OBJ) $(C_) $(GLSRC)sjpx.c
+
++$(GLD)sjpx_.dev : $(LIB_MAK) $(ECHOGS_XE) $(LIB_MAK) $(MAKEDIRS)
++ $(SETMOD) $(GLD)sjpx_
++
+ # luratech version
+ sjpx_luratech=$(GLOBJ)sjpx_luratech.$(OBJ)
+ $(GLD)sjpx_luratech.dev : $(LIB_MAK) $(ECHOGS_XE) \
+diff --git a/psi/int.mak b/psi/int.mak
+index f9d667d..db01b65 100644
+--- a/psi/int.mak
++++ b/psi/int.mak
+@@ -1290,6 +1290,9 @@ $(PSD)jpx.dev : $(INT_MAK) $(ECHOGS_XE) $(PSD)jpx_$(JPX_LIB).dev\
+ $(MAKEDIRS)
+ $(CP_) $(PSD)jpx_$(JPX_LIB).dev $(PSD)jpx.dev
+
++$(PSD)jpx_.dev : $(ECHOGS_XE) $(INT_MAK) $(MAKEDIRS)
++ $(SETMOD) $(PSD)jpx_
++
+ fjpx_luratech=$(PSOBJ)zfjpx_luratech.$(OBJ)
+
+ $(PSOBJ)zfjpx.$(OBJ) : $(PSSRC)zfjpx.c $(OP) $(memory__h)\
+--
+1.9.1
+
diff --git a/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch b/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch
new file mode 100644
index 0000000..b445a6c
--- /dev/null
+++ b/meta/recipes-extended/ghostscript/files/do-not-check-local-libpng-source.patch
@@ -0,0 +1,38 @@
+From 5ef8b85bc98f3bd9a15d5f47e24d3e23ae27c265 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Mon, 18 Jan 2016 01:00:30 -0500
+Subject: [PATCH] configure.ac: do not check local png source
+
+In oe-core, it did not need to compile local libpng
+source in ghostscript, so do not check local png
+source, and directly check the existance of shared
+libpng library.
+
+Upstream-Status: Inappropriate [OE-Core specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index ab30a97..b762fd7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -955,11 +955,11 @@ AC_SUBST(ZLIBDIR)
+ AC_SUBST(FT_SYS_ZLIB)
+
+ dnl png for the png output device; it also requires zlib
+-LIBPNGDIR=src
++LIBPNGDIR=$srcdir/libpng
+ PNGDEVS=''
+ PNGDEVS_ALL='png48 png16m pnggray pngmono png256 png16 pngalpha'
+ AC_MSG_CHECKING([for local png library source])
+-if test -f $srcdir/libpng/pngread.c; then
++if false; then
+ AC_MSG_RESULT([yes])
+ SHARE_LIBPNG=0
+ LIBPNGDIR=$srcdir/libpng
+--
+1.9.1
+
diff --git a/meta/recipes-extended/ghostscript/ghostscript_9.16.bb b/meta/recipes-extended/ghostscript/ghostscript_9.18.bb
similarity index 87%
rename from meta/recipes-extended/ghostscript/ghostscript_9.16.bb
rename to meta/recipes-extended/ghostscript/ghostscript_9.18.bb
index d584c49..d4222c7 100644
--- a/meta/recipes-extended/ghostscript/ghostscript_9.16.bb
+++ b/meta/recipes-extended/ghostscript/ghostscript_9.18.bb
@@ -13,13 +13,16 @@ SECTION = "console/utils"
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b17cea54743435ab2a581c237bea294a"
-DEPENDS = "ghostscript-native tiff jpeg fontconfig cups"
-DEPENDS_class-native = ""
+DEPENDS = "ghostscript-native tiff jpeg fontconfig cups libpng"
+DEPENDS_class-native = "libpng-native"
SRC_URI_BASE = "http://downloads.ghostscript.com/public/ghostscript-${PV}.tar.gz \
file://ghostscript-9.15-parallel-make.patch \
file://ghostscript-9.16-Werror-return-type.patch \
file://png_mak.patch \
+ file://0001-Bug-696497-Fix-support-for-building-with-no-jbig2-de.patch \
+ file://0002-Bug-696497-part-2-fix-support-for-building-with-a-JP.patch \
+ file://do-not-check-local-libpng-source.patch \
"
SRC_URI = "${SRC_URI_BASE} \
@@ -34,8 +37,8 @@ SRC_URI_class-native = "${SRC_URI_BASE} \
file://base-genht.c-add-a-preprocessor-define-to-allow-fope.patch \
"
-SRC_URI[md5sum] = "829319325bbdb83f5c81379a8f86f38f"
-SRC_URI[sha256sum] = "746d77280cca8afdd3d4c2c1389e332ed9b0605bd107bcaae1d761b061d1a68d"
+SRC_URI[md5sum] = "33a47567d7a591c00a253caddd12a88a"
+SRC_URI[sha256sum] = "5fc93079749a250be5404c465943850e3ed5ffbc0d5c07e10c7c5ee8afbbdb1b"
EXTRA_OECONF = "--without-x --with-system-libtiff --without-jbig2dec \
--with-fontpath=${datadir}/fonts \
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] strace: Backport fixes for compiling with clang
2016-02-29 19:41 [PATCH 0/2] Clang inspired fixes Khem Raj
2016-02-29 19:41 ` [PATCH 1/2] ghostscript: 9.16 -> 9.18 Khem Raj
@ 2016-02-29 19:41 ` Khem Raj
1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2016-02-29 19:41 UTC (permalink / raw)
To: openembedded-core
Backport fixes needed to avoid use of VLAs which is not available
on clang/llvm
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...01-Move-gcc-compat-macros-to-gcc_compat.h.patch | 176 ++++++++++++
...1-scm_rights-fd.test-rewrite-without-fork.patch | 198 +++++++++++++
.../strace/0001-tests-introduce-libtests.patch | 306 +++++++++++++++++++++
.../0001-tests-scm_rights.c-use-libtests.patch | 54 ++++
meta/recipes-devtools/strace/strace_4.11.bb | 4 +
5 files changed, 738 insertions(+)
create mode 100644 meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch
create mode 100644 meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch
diff --git a/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch b/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch
new file mode 100644
index 0000000..aa61e15
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace/0001-Move-gcc-compat-macros-to-gcc_compat.h.patch
@@ -0,0 +1,176 @@
+From f32126ba790dd4e61d43a2140b24f02426297bb6 Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Thu, 31 Dec 2015 14:19:41 +0000
+Subject: [PATCH] Move gcc compat macros to gcc_compat.h
+
+* defs.h: Include "gcc_compat.h".
+(GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
+ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
+ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): Move ...
+* gcc_compat.h: ... here.
+* Makefile.am (strace_SOURCES): Add gcc_compat.h.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ Makefile.am | 1 +
+ defs.h | 43 +----------------------------------
+ gcc_compat.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 75 insertions(+), 42 deletions(-)
+ create mode 100644 gcc_compat.h
+
+diff --git a/Makefile.am b/Makefile.am
+index ab52778..d43608d 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -97,6 +97,7 @@ strace_SOURCES = \
+ flock.c \
+ flock.h \
+ futex.c \
++ gcc_compat.h \
+ get_robust_list.c \
+ getcpu.c \
+ getcwd.c \
+diff --git a/defs.h b/defs.h
+index 283ab1f..bae212c 100644
+--- a/defs.h
++++ b/defs.h
+@@ -55,6 +55,7 @@
+ #include <sys/syscall.h>
+
+ #include "mpers_type.h"
++#include "gcc_compat.h"
+
+ #ifndef HAVE_STRERROR
+ const char *strerror(int);
+@@ -68,48 +69,6 @@ const char *strerror(int);
+ extern char *stpcpy(char *dst, const char *src);
+ #endif
+
+-#if defined __GNUC__ && defined __GNUC_MINOR__
+-# define GNUC_PREREQ(maj, min) \
+- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+-#else
+-# define __attribute__(x) /* empty */
+-# define GNUC_PREREQ(maj, min) 0
+-#endif
+-
+-#if GNUC_PREREQ(2, 5)
+-# define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
+-#else
+-# define ATTRIBUTE_NORETURN /* empty */
+-#endif
+-
+-#if GNUC_PREREQ(2, 7)
+-# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args))
+-# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
+-# define ATTRIBUTE_PACKED __attribute__((__packed__))
+-#else
+-# define ATTRIBUTE_FORMAT(args) /* empty */
+-# define ATTRIBUTE_ALIGNED(arg) /* empty */
+-# define ATTRIBUTE_PACKED /* empty */
+-#endif
+-
+-#if GNUC_PREREQ(3, 0)
+-# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
+-#else
+-# define ATTRIBUTE_MALLOC /* empty */
+-#endif
+-
+-#if GNUC_PREREQ(3, 1)
+-# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
+-#else
+-# define ATTRIBUTE_NOINLINE /* empty */
+-#endif
+-
+-#if GNUC_PREREQ(4, 3)
+-# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
+-#else
+-# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
+-#endif
+-
+ #ifndef offsetof
+ # define offsetof(type, member) \
+ (((char *) &(((type *) NULL)->member)) - ((char *) (type *) NULL))
+diff --git a/gcc_compat.h b/gcc_compat.h
+new file mode 100644
+index 0000000..1f2c835
+--- /dev/null
++++ b/gcc_compat.h
+@@ -0,0 +1,73 @@
++/*
++ * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#ifndef GCC_COMPAT_H_
++#define GCC_COMPAT_H_
++
++#if defined __GNUC__ && defined __GNUC_MINOR__
++# define GNUC_PREREQ(maj, min) \
++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++#else
++# define __attribute__(x) /* empty */
++# define GNUC_PREREQ(maj, min) 0
++#endif
++
++#if GNUC_PREREQ(2, 5)
++# define ATTRIBUTE_NORETURN __attribute__((__noreturn__))
++#else
++# define ATTRIBUTE_NORETURN /* empty */
++#endif
++
++#if GNUC_PREREQ(2, 7)
++# define ATTRIBUTE_FORMAT(args) __attribute__((__format__ args))
++# define ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
++# define ATTRIBUTE_PACKED __attribute__((__packed__))
++#else
++# define ATTRIBUTE_FORMAT(args) /* empty */
++# define ATTRIBUTE_ALIGNED(arg) /* empty */
++# define ATTRIBUTE_PACKED /* empty */
++#endif
++
++#if GNUC_PREREQ(3, 0)
++# define ATTRIBUTE_MALLOC __attribute__((__malloc__))
++#else
++# define ATTRIBUTE_MALLOC /* empty */
++#endif
++
++#if GNUC_PREREQ(3, 1)
++# define ATTRIBUTE_NOINLINE __attribute__((__noinline__))
++#else
++# define ATTRIBUTE_NOINLINE /* empty */
++#endif
++
++#if GNUC_PREREQ(4, 3)
++# define ATTRIBUTE_ALLOC_SIZE(args) __attribute__((__alloc_size__ args))
++#else
++# define ATTRIBUTE_ALLOC_SIZE(args) /* empty */
++#endif
++
++#endif
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch b/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch
new file mode 100644
index 0000000..c4e645b
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace/0001-scm_rights-fd.test-rewrite-without-fork.patch
@@ -0,0 +1,198 @@
+From 3fdcdd47c6a67585123a0a0c8fffabcc9f79a3a2 Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Tue, 12 Jan 2016 14:47:12 +0000
+Subject: [PATCH] scm_rights-fd.test: rewrite without fork
+
+* tests/scm_rights.c (main): Rewrite without fork.
+Place all objects passed to sendmsg and recvmsg at the end
+of memory pages followed by inaccessible pages.
+* tests/scm_rights-fd.test: Update.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ tests/scm_rights-fd.test | 12 ++---
+ tests/scm_rights.c | 122 ++++++++++++++++++++++-------------------------
+ 2 files changed, 63 insertions(+), 71 deletions(-)
+
+diff --git a/tests/scm_rights-fd.test b/tests/scm_rights-fd.test
+index a32ef36..48c5028 100755
+--- a/tests/scm_rights-fd.test
++++ b/tests/scm_rights-fd.test
+@@ -49,18 +49,18 @@ touch -- "$file" ||
+ framework_skip_ 'failed to create a file'
+
+ run_prog ./scm_rights /dev/zero
+-run_strace_merge -y -x -enetwork $args "$file"
++run_strace -y -x -enetwork $args "$file"
+
++sample='\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff'
+ n='[1-9][0-9]*'
+-msg='\{msg_name\(0\)=NULL, msg_iov\(1\)=\[\{"\\x00\\x00\\x00\\x00[^"]*", '"$n"'\}\], msg_controllen='"$n"
+-rights='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, \[3</dev/null>, 4</dev/zero>, 5</[^}>]*/(A\\n){127}Z>\]\}'
++msg='\{msg_name\(0\)=NULL, msg_iov\(1\)=\[\{"'"$sample"'", 15\}\], msg_controllen='"$n"
++rights='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, \[4</dev/null>, 5</dev/zero>, 6</[^}>]*/(A\\n){127}Z>\]\}'
+ creds='\{cmsg_len='"$n"', cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, \{pid='"$n"', uid=[0-9]+, gid=[0-9]+\}\}'
+-prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +'
+ EXPECTED="$LOG.expected"
+
+ cat > "$EXPECTED" << __EOF__
+-${prefix}sendmsg\\(1<socket:\\[[0-9]+\\]>, $msg, \\[$rights\\], msg_flags=0\\}, 0\\) += $n
+-${prefix}recvmsg\\(0<socket:\\[[0-9]+\\]>, $msg, \\[$creds, $rights\\], msg_flags=0\\}, 0\\) += $n
++sendmsg\\(3<socket:\\[[0-9]+\\]>, $msg, \\[$rights\\], msg_flags=0\\}, 0\\) = 15
++recvmsg\\(0<socket:\\[[0-9]+\\]>, $msg, \\[$creds, $rights\\], msg_flags=0\\}, 0\\) = 15
+ __EOF__
+
+ match_grep "$LOG" "$EXPECTED"
+diff --git a/tests/scm_rights.c b/tests/scm_rights.c
+index 1e5e850..00af4d5 100644
+--- a/tests/scm_rights.c
++++ b/tests/scm_rights.c
+@@ -27,26 +27,39 @@
+
+ #include "tests.h"
+ #include <assert.h>
+-#include <string.h>
+-#include <stdlib.h>
+-#include <unistd.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
+ #include <sys/socket.h>
+-#include <sys/wait.h>
+
+ int main(int ac, const char **av)
+ {
+- int i;
+- int data = 0;
+- struct iovec iov = {
+- .iov_base = &data,
+- .iov_len = sizeof(iov)
+- };
++ assert(ac > 0);
++ int fds[ac];
++
++ static const char sample[] =
++ "\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
++ const unsigned int data_size = sizeof(sample) - 1;
++ void *data = tail_alloc(data_size);
++ memcpy(data, sample, data_size);
++
++ struct iovec *iov = tail_alloc(sizeof(struct iovec));
++ iov->iov_base = data;
++ iov->iov_len = data_size;
+
+- while ((i = open("/dev/null", O_RDWR)) < 3)
++ struct msghdr *mh = tail_alloc(sizeof(struct msghdr));
++ memset(mh, 0, sizeof(*mh));
++ mh->msg_iov = iov;
++ mh->msg_iovlen = 1;
++
++ int i;
++ while ((i = open("/dev/null", O_RDWR)) <= ac + 2)
+ assert(i >= 0);
+- (void) close(3);
++ while (i > 2)
++ assert(close(i--) == 0);
++ assert(close(0) == 0);
+
+ int sv[2];
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
+@@ -55,60 +68,39 @@ int main(int ac, const char **av)
+ if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)))
+ perror_msg_and_skip("setsockopt");
+
+- pid_t pid = fork();
+- if (pid < 0)
+- perror_msg_and_fail("fork");
+-
+- if (pid) {
+- assert(close(sv[0]) == 0);
+- assert(dup2(sv[1], 1) == 1);
+- assert(close(sv[1]) == 0);
+-
+- int fds[ac];
+- assert((fds[0] = open("/dev/null", O_RDWR)) == 3);
+- for (i = 1; i < ac; ++i)
+- assert((fds[i] = open(av[i], O_RDONLY)) == i + 3);
+-
+- union {
+- struct cmsghdr cmsg;
+- char buf[CMSG_LEN(sizeof(fds))];
+- } control;
+-
+- control.cmsg.cmsg_level = SOL_SOCKET;
+- control.cmsg.cmsg_type = SCM_RIGHTS;
+- control.cmsg.cmsg_len = CMSG_LEN(sizeof(fds));
+- memcpy(CMSG_DATA(&control.cmsg), fds, sizeof(fds));
+-
+- struct msghdr mh = {
+- .msg_iov = &iov,
+- .msg_iovlen = 1,
+- .msg_control = &control,
+- .msg_controllen = sizeof(control)
+- };
+-
+- assert(sendmsg(1, &mh, 0) == sizeof(iov));
+- assert(close(1) == 0);
+-
+- int status;
+- assert(waitpid(pid, &status, 0) == pid);
+- assert(status == 0);
+- } else {
+- assert(close(sv[1]) == 0);
+- assert(dup2(sv[0], 0) == 0);
+- assert(close(sv[0]) == 0);
+-
+- struct cmsghdr control[4 + ac * sizeof(int) / sizeof(struct cmsghdr)];
+-
+- struct msghdr mh = {
+- .msg_iov = &iov,
+- .msg_iovlen = 1,
+- .msg_control = control,
+- .msg_controllen = sizeof(control)
+- };
+-
+- assert(recvmsg(0, &mh, 0) == sizeof(iov));
+- assert(close(0) == 0);
++ assert((fds[0] = open("/dev/null", O_RDWR)) == 4);
++ for (i = 1; i < ac; ++i)
++ assert((fds[i] = open(av[i], O_RDONLY)) == i + 4);
++
++ unsigned int cmsg_size = CMSG_SPACE(sizeof(fds));
++ struct cmsghdr *cmsg = tail_alloc(cmsg_size);
++ memset(cmsg, 0, cmsg_size);
++ cmsg->cmsg_level = SOL_SOCKET;
++ cmsg->cmsg_type = SCM_RIGHTS;
++ cmsg->cmsg_len = CMSG_LEN(sizeof(fds));
++ memcpy(CMSG_DATA(cmsg), fds, sizeof(fds));
++
++ mh->msg_control = cmsg;
++ mh->msg_controllen = cmsg_size;
++
++ assert(sendmsg(sv[1], mh, 0) == (int) data_size);
++
++ assert(close(sv[1]) == 0);
++ assert(open("/dev/null", O_RDWR) == sv[1]);
++
++ for (i = 0; i < ac; ++i) {
++ assert(close(fds[i]) == 0);
++ fds[i] = 0;
+ }
+
++ cmsg_size += CMSG_SPACE(sizeof(struct ucred));
++ cmsg = tail_alloc(cmsg_size);
++ memset(cmsg, 0, cmsg_size);
++ mh->msg_control = cmsg;
++ mh->msg_controllen = cmsg_size;
++
++ assert(recvmsg(0, mh, 0) == (int) data_size);
++ assert(close(0) == 0);
++
+ return 0;
+ }
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch b/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch
new file mode 100644
index 0000000..1575ecd
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace/0001-tests-introduce-libtests.patch
@@ -0,0 +1,306 @@
+From 87e6b230fff800eb768b68b2e5173ebbe83fd3ef Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Sat, 2 Jan 2016 12:05:14 +0000
+Subject: [PATCH] tests: introduce libtests
+
+Introduce tests/libtests.a with common functions for use in tests.
+
+* tests/tests.h: New file.
+* tests/error_msg.c: Likewise.
+* tests/tail_alloc.c: Likewise.
+* tests/get_page_size.c: Likewise.
+* tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS,
+check_LIBRARIES, LDADD): New variables.
+(clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD,
+pc_LDADD, times_LDADD): Add $(LDADD).
+* tests/.gitignore: Add libtests.a.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ tests/.gitignore | 1 +
+ tests/Makefile.am | 20 ++++++++++----
+ tests/error_msg.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ tests/get_page_size.c | 13 +++++++++
+ tests/tail_alloc.c | 52 ++++++++++++++++++++++++++++++++++++
+ tests/tests.h | 62 ++++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 217 insertions(+), 5 deletions(-)
+ create mode 100644 tests/error_msg.c
+ create mode 100644 tests/get_page_size.c
+ create mode 100644 tests/tail_alloc.c
+ create mode 100644 tests/tests.h
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 386a2c2..62d0e56 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -40,6 +40,16 @@ AM_CPPFLAGS = $(ARCH_MFLAGS) \
+ -I$(top_srcdir)
+ AM_LDFLAGS = $(ARCH_MFLAGS)
+
++libtests_a_SOURCES = \
++ get_page_size.c \
++ error_msg.c \
++ tail_alloc.c \
++ tests.h \
++ # end of libtests_a_SOURCES
++libtests_a_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
++check_LIBRARIES = libtests.a
++LDADD = libtests.a
++
+ check_PROGRAMS = \
+ _newselect \
+ adjtimex \
+@@ -146,19 +156,19 @@ check_PROGRAMS = \
+ xettimeofday \
+ # end of check_PROGRAMS
+
+-clock_xettime_LDADD = -lrt
+-filter_unavailable_LDADD = -lpthread
++clock_xettime_LDADD = -lrt $(LDADD)
++filter_unavailable_LDADD = -lpthread $(LDADD)
+ fstat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ fstatat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ ftruncate64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ lstat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ mmap64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+-mq_LDADD = -lrt
++mq_LDADD = -lrt $(LDADD)
+ newfstatat_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+-pc_LDADD = $(dl_LIBS)
++pc_LDADD = $(dl_LIBS) $(LDADD)
+ stat64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ statfs_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+-times_LDADD = -lrt
++times_LDADD = -lrt $(LDADD)
+ truncate64_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ uio_CPPFLAGS = $(AM_CPPFLAGS) -D_FILE_OFFSET_BITS=64
+ stack_fcall_SOURCES = stack-fcall.c \
+diff --git a/tests/error_msg.c b/tests/error_msg.c
+new file mode 100644
+index 0000000..3fd3411
+--- /dev/null
++++ b/tests/error_msg.c
+@@ -0,0 +1,74 @@
++/*
++ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include "tests.h"
++#include <errno.h>
++#include <stdarg.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++void
++perror_msg_and_fail(const char *fmt, ...)
++{
++ int err_no = errno;
++ va_list p;
++
++ va_start(p, fmt);
++ vfprintf(stderr, fmt, p);
++ if (err_no)
++ fprintf(stderr, ": %s\n", strerror(err_no));
++ else
++ putc('\n', stderr);
++ exit(1);
++}
++
++void
++error_msg_and_skip(const char *fmt, ...)
++{
++ va_list p;
++
++ va_start(p, fmt);
++ vfprintf(stderr, fmt, p);
++ putc('\n', stderr);
++ exit(77);
++}
++
++void
++perror_msg_and_skip(const char *fmt, ...)
++{
++ int err_no = errno;
++ va_list p;
++
++ va_start(p, fmt);
++ vfprintf(stderr, fmt, p);
++ if (err_no)
++ fprintf(stderr, ": %s\n", strerror(err_no));
++ else
++ putc('\n', stderr);
++ exit(77);
++}
+diff --git a/tests/get_page_size.c b/tests/get_page_size.c
+new file mode 100644
+index 0000000..aeea861
+--- /dev/null
++++ b/tests/get_page_size.c
+@@ -0,0 +1,13 @@
++#include "tests.h"
++#include <unistd.h>
++
++size_t
++get_page_size(void)
++{
++ static size_t page_size;
++
++ if (!page_size)
++ page_size = sysconf(_SC_PAGESIZE);
++
++ return page_size;
++}
+diff --git a/tests/tail_alloc.c b/tests/tail_alloc.c
+new file mode 100644
+index 0000000..2b8b14e
+--- /dev/null
++++ b/tests/tail_alloc.c
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include "tests.h"
++#include <string.h>
++#include <sys/mman.h>
++
++void *
++tail_alloc(const size_t size)
++{
++ const size_t page_size = get_page_size();
++ const size_t len = (size + page_size - 1) & -page_size;
++ const size_t alloc_size = len + 2 * page_size;
++
++ void *p = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
++ if (MAP_FAILED == p)
++ perror_msg_and_fail("mmap(%zu)", alloc_size);
++
++ void *start_work = p + page_size;
++ void *tail_guard = start_work + len;
++
++ if (munmap(p, page_size) || munmap(tail_guard, page_size))
++ perror_msg_and_fail("munmap");
++
++ memset(start_work, 0xff, len);
++ return tail_guard - size;
++}
+diff --git a/tests/tests.h b/tests/tests.h
+new file mode 100644
+index 0000000..91fa24e
+--- /dev/null
++++ b/tests/tests.h
+@@ -0,0 +1,62 @@
++/*
++ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. The name of the author may not be used to endorse or promote products
++ * derived from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
++ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#ifndef TESTS_H_
++# define TESTS_H_
++
++# ifdef HAVE_CONFIG_H
++# include "config.h"
++# endif
++
++# include <sys/types.h>
++# include "gcc_compat.h"
++
++/* Cached sysconf(_SC_PAGESIZE). */
++size_t get_page_size(void);
++
++/* Print message and strerror(errno) to stderr, then exit(1). */
++void perror_msg_and_fail(const char *, ...)
++ ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
++/* Print message to stderr, then exit(77). */
++void error_msg_and_skip(const char *, ...)
++ ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
++/* Print message and strerror(errno) to stderr, then exit(77). */
++void perror_msg_and_skip(const char *, ...)
++ ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
++
++/*
++ * Allocate memory that ends on the page boundary.
++ * Pages allocated by this call are preceeded by an unmapped page
++ * and followed also by an unmapped page.
++ */
++void *tail_alloc(const size_t)
++ ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
++
++# define SKIP_MAIN_UNDEFINED(arg) \
++ int main(void) { error_msg_and_skip("undefined: %s", arg); }
++
++#endif
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch b/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch
new file mode 100644
index 0000000..3fbab8b
--- /dev/null
+++ b/meta/recipes-devtools/strace/strace/0001-tests-scm_rights.c-use-libtests.patch
@@ -0,0 +1,54 @@
+From 339a15b619b479c63cafba21d5fc359e613d9ee8 Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Mon, 4 Jan 2016 23:53:31 +0000
+Subject: [PATCH] tests/scm_rights.c: use libtests
+
+* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
+---
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Backport
+
+ tests/scm_rights.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/tests/scm_rights.c b/tests/scm_rights.c
+index c41444f..1e5e850 100644
+--- a/tests/scm_rights.c
++++ b/tests/scm_rights.c
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
++ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+@@ -25,6 +25,7 @@
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#include "tests.h"
+ #include <assert.h>
+ #include <string.h>
+ #include <stdlib.h>
+@@ -48,12 +49,15 @@ int main(int ac, const char **av)
+ (void) close(3);
+
+ int sv[2];
+- assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
++ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
++ perror_msg_and_skip("socketpair");
+ int one = 1;
+- assert(setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) == 0);
++ if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)))
++ perror_msg_and_skip("setsockopt");
+
+ pid_t pid = fork();
+- assert(pid >= 0);
++ if (pid < 0)
++ perror_msg_and_fail("fork");
+
+ if (pid) {
+ assert(close(sv[0]) == 0);
+--
+1.9.1
+
diff --git a/meta/recipes-devtools/strace/strace_4.11.bb b/meta/recipes-devtools/strace/strace_4.11.bb
index 51ec5b5..7391388 100644
--- a/meta/recipes-devtools/strace/strace_4.11.bb
+++ b/meta/recipes-devtools/strace/strace_4.11.bb
@@ -11,6 +11,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/strace/strace-${PV}.tar.xz \
file://use-asm-sgidefs.h.patch \
file://0001-arc-metag-nios2-or1k-tile-fix-build.patch \
file://Makefile-ptest.patch \
+ file://0001-tests-scm_rights.c-use-libtests.patch \
+ file://0001-scm_rights-fd.test-rewrite-without-fork.patch \
+ file://0001-Move-gcc-compat-macros-to-gcc_compat.h.patch \
+ file://0001-tests-introduce-libtests.patch \
file://run-ptest \
"
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-29 19:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29 19:41 [PATCH 0/2] Clang inspired fixes Khem Raj
2016-02-29 19:41 ` [PATCH 1/2] ghostscript: 9.16 -> 9.18 Khem Raj
2016-02-29 19:41 ` [PATCH 2/2] strace: Backport fixes for compiling with clang Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox