From 0b977787374349328a21af0deade30d534cf3978 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 18 May 2022 23:40:38 +0100 Subject: fixed gcc loader/linker errors --- repo/system/libaio/gnudesignator.patch | 24 +++++++++++ repo/system/libaio/libaio-cppflags.patch | 17 ++++++++ repo/system/libaio/libaio-errno.patch | 11 +++++ repo/system/libaio/libaio-optional-werror.patch | 31 ++++++++++++++ repo/system/libaio/libaio.xibuild | 30 ++++++++++++++ repo/system/libaio/test-poll.patch | 12 ++++++ repo/system/libaio/test.patch | 55 +++++++++++++++++++++++++ 7 files changed, 180 insertions(+) create mode 100644 repo/system/libaio/gnudesignator.patch create mode 100644 repo/system/libaio/libaio-cppflags.patch create mode 100644 repo/system/libaio/libaio-errno.patch create mode 100644 repo/system/libaio/libaio-optional-werror.patch create mode 100644 repo/system/libaio/libaio.xibuild create mode 100644 repo/system/libaio/test-poll.patch create mode 100644 repo/system/libaio/test.patch (limited to 'repo/system/libaio') diff --git a/repo/system/libaio/gnudesignator.patch b/repo/system/libaio/gnudesignator.patch new file mode 100644 index 0000000..f62c407 --- /dev/null +++ b/repo/system/libaio/gnudesignator.patch @@ -0,0 +1,24 @@ +--- /dev/null 2022-05-16 19:50:41.952900736 +0100 ++++ build/gnudesignator.patch 2022-05-16 19:52:21.655900238 +0100 +@@ -0,0 +1,11 @@ ++--- build-old/harness/cases/13.t 2022-05-16 19:50:41.952900736 +0100 +++++ build/harness/cases/13.t 2022-05-16 19:49:43.896896077 +0100 ++@@ -35,7 +35,7 @@ ++ status |= attempt_io_submit(io_ctx, IOS, iocb_list, IOS); ++ ++ for (i=0; i +-#include ++#include + + #include "libaio.h" + #include "vsys_def.h" diff --git a/repo/system/libaio/libaio-optional-werror.patch b/repo/system/libaio/libaio-optional-werror.patch new file mode 100644 index 0000000..a5bd404 --- /dev/null +++ b/repo/system/libaio/libaio-optional-werror.patch @@ -0,0 +1,31 @@ +From ebe62b178f3e5fcde8a311e64aaffe62099204a5 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Sun, 21 Apr 2019 12:44:26 +0200 +Subject: [PATCH] make -Werror into an optional flag + +This lets distros disable the flag as random errors might come up with +different compiler flags and older/newer toolchain versions. + +Signed-off-by: Mike Frysinger +--- + harness/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/harness/Makefile b/harness/Makefile +index f477737..a155c4b 100644 +--- a/harness/Makefile ++++ b/harness/Makefile +@@ -6,7 +6,8 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS) + HARNESS_SRCS:=main.c + # io_queue.c + +-CFLAGS+=-Wall -Werror -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE) ++CFLAGS_WERROR?=-Werror ++CFLAGS+=-Wall $(CFLAGS_WERROR) -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE) + #-lpthread -lrt + + all: $(PROGS) +-- +2.21.0 + + diff --git a/repo/system/libaio/libaio.xibuild b/repo/system/libaio/libaio.xibuild new file mode 100644 index 0000000..6c9b45f --- /dev/null +++ b/repo/system/libaio/libaio.xibuild @@ -0,0 +1,30 @@ +#!/bin/sh + +NAME="libaio" +DESC="Asynchronous input/output library" + +MAKEDEPS="make " +DEPS="musl " + +PKG_VER=0.3.112 +SOURCE="https://releases.pagure.org/libaio/libaio-$PKG_VER.tar.gz" +ADDITIONAL="test.patch test-poll.patch libaio-optional-werror.patch libaio-errno.patch libaio-cppflags.patch gnudesignator.patch" + +prepare () { + apply_patches +} + +build () { + CFLAGS="-Wgnu-designator" make PREFIX=/usr +} + +check() { + make partcheck +} + +package () { + make PREFIX=/usr DESTDIR=$PKG_DEST install + cd man + find ./ -name "*.3" -exec install -Dm 644 {} "$PKG_DEST"/usr/share/man/man3/{} \; + +} diff --git a/repo/system/libaio/test-poll.patch b/repo/system/libaio/test-poll.patch new file mode 100644 index 0000000..1183a4b --- /dev/null +++ b/repo/system/libaio/test-poll.patch @@ -0,0 +1,12 @@ +diff -Nurp a/harness/cases/22.t b/harness/cases/22.t +--- a/harness/cases/22.t 2018-10-22 20:59:34.000000000 +0100 ++++ b/harness/cases/22.t 2022-02-26 09:48:59.421311473 +0000 +@@ -11,7 +11,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + diff --git a/repo/system/libaio/test.patch b/repo/system/libaio/test.patch new file mode 100644 index 0000000..0822723 --- /dev/null +++ b/repo/system/libaio/test.patch @@ -0,0 +1,55 @@ +From: Lee Duncan +Date: Thu, 11 Feb 2021 11:34:42 -0800 +Subject: [PATCH] Fix test issue with gcc-11 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Test 3.t exercises io_submit() with invalid addresses, +and one test attempted to pass in "-1" as an invalid +pointer. But gcc-11 realizes you cannot take an offset +from an invalid pointer, making it impossible to +compile or run this test: + +> sh# make CC=gcc-11 partcheck +> make[1]: Entering directory '/alt/public_software/libaio/src' +> make[1]: Nothing to be done for 'all'. +> make[1]: Leaving directory '/alt/public_software/libaio/src' +> make[1]: Entering directory '/alt/public_software/libaio/harness' +> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/2.t\" -o cases/2.p main.c ../src/libaio.a -lpthread +> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/3.t\" -o cases/3.p main.c ../src/libaio.a -lpthread +> In file included from main.c:24: +> cases/3.t: In function ‘test_main’: +> cases/3.t:18:19: error: ‘attempt_io_submit’ accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=] +> 18 | status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT); +> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +> cases/3.t:18:19: note: referencing argument 3 of type ‘struct iocb **’ +> In file included from cases/3.t:5, +> from main.c:24: +> cases/aio_setup.h:15:5: note: in a call to function ‘attempt_io_submit’ +> 15 | int attempt_io_submit(io_context_t ctx, long nr, struct iocb *ios[], int expect) +> | ^~~~~~~~~~~~~~~~~ +> cc1: all warnings being treated as errors +> make[1]: *** [Makefile:19: cases/3.p] Error 1 +> make[1]: Leaving directory '/alt/public_software/libaio/harness' +> make: *** [Makefile:23: partcheck] Error 2 + +The fix is to remove this one test case, since the compiler now +ensures the running code will never see this case. + +Signed-off-by: Lee Duncan +--- + harness/cases/3.t | 1 - + 1 file changed, 1 deletion(-) + +diff -Nurp a/harness/cases/3.t b/harness/cases/3.t +--- a/harness/cases/3.t 2018-10-22 20:59:34.000000000 +0100 ++++ b/harness/cases/3.t 2022-02-26 09:46:51.969845084 +0000 +@@ -15,7 +15,6 @@ int test_main(void) + status |= attempt_io_submit(BAD_CTX, 1, good_ios, -EINVAL); + status |= attempt_io_submit( io_ctx, 0, good_ios, 0); + status |= attempt_io_submit( io_ctx, 1, NULL, -EFAULT); +- status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT); + status |= attempt_io_submit( io_ctx, 2, bad1_ios, -EFAULT); + status |= attempt_io_submit( io_ctx, 2, bad2_ios, -EFAULT); + status |= attempt_io_submit( io_ctx, -1, good_ios, -EINVAL); -- cgit v1.2.1