!59 llvm平行宇宙计划:修复使用clang构建遇到的错误
From: @chenxi-mao Reviewed-by: @swf504, @liubo254 Signed-off-by: @swf504
This commit is contained in:
commit
ae55a04e7b
56
bugfix-Fix-build-error-if-compiler-is-clang.patch
Normal file
56
bugfix-Fix-build-error-if-compiler-is-clang.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From 8c4d190b7a5ff484d4393d1d445a4245bda74c92 Mon Sep 17 00:00:00 2001
|
||||
From: Chenxi Mao <chenxi.mao@suse.com>
|
||||
Date: Wed, 5 Apr 2023 19:39:22 +0800
|
||||
Subject: [PATCH 1/1] Fix build error if compiler is clang
|
||||
|
||||
There is a build error if compiler is clang:
|
||||
clang -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS --config /usr/lib/rpm/generic-hardened-clang.cfg -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror -I../src -g -O2 -Wno-stringop-overflow -DTEST_NAME=\"cases/3.t\" -o cases/3.p main.c ../src/libaio.a -lpthread
|
||||
error: unknown warning option '-Wno-stringop-overflow'; did you mean '-Wno-shift-overflow'? [-Werror,-Wunknown-warning-option]
|
||||
|
||||
./cases/13.t:38:26: error: use of GNU old-style field designator extension [-Werror,-Wgnu-designator]
|
||||
struct timespec ts = { tv_sec: 30, tv_nsec: 0 };
|
||||
^~~~~~~
|
||||
.tv_sec =
|
||||
./cases/13.t:38:38: error: use of GNU old-style field designator extension [-Werror,-Wgnu-designator]
|
||||
struct timespec ts = { tv_sec: 30, tv_nsec: 0 };
|
||||
^~~~~~~~
|
||||
.tv_nsec =
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
harness/Makefile | 2 ++
|
||||
harness/cases/13.t | 2 +-
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/harness/Makefile b/harness/Makefile
|
||||
index d7243a6..8d067eb 100644
|
||||
--- a/harness/Makefile
|
||||
+++ b/harness/Makefile
|
||||
@@ -10,10 +10,12 @@ HARNESS_SRCS:=main.c
|
||||
CFLAGS+=-Wall -Werror -I../src -g -O2
|
||||
#-lpthread -lrt
|
||||
|
||||
+ifeq ($(CC),gcc)
|
||||
# gcc-11 does not like the test case in 3.t that
|
||||
# passes an invalid pointer (-1) to the kernel, so
|
||||
# tell the compiler we do not need a warning here
|
||||
cases/3.p: CFLAGS+=-Wno-stringop-overflow
|
||||
+endif
|
||||
|
||||
# Change this on the build line to run tests against the installed libraries:
|
||||
# make LIBAIO=-laio partcheck
|
||||
diff --git a/harness/cases/13.t b/harness/cases/13.t
|
||||
index 5f18005..9e82380 100644
|
||||
--- a/harness/cases/13.t
|
||||
+++ b/harness/cases/13.t
|
||||
@@ -35,7 +35,7 @@ int test_main(void)
|
||||
status |= attempt_io_submit(io_ctx, IOS, iocb_list, IOS);
|
||||
|
||||
for (i=0; i<IOS; i++) {
|
||||
- struct timespec ts = { tv_sec: 30, tv_nsec: 0 };
|
||||
+ struct timespec ts = { .tv_sec = 30, .tv_nsec = 0 };
|
||||
struct io_event event;
|
||||
struct iocb *iocb;
|
||||
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
Name: libaio
|
||||
Version: 0.3.113
|
||||
Release: 7
|
||||
Release: 8
|
||||
Summary: Linux-native asynchronous I/O access library
|
||||
License: LGPLv2+
|
||||
URL: https://pagure.io/libaio
|
||||
@ -14,6 +14,7 @@ Patch3: 0003-libaio-fix-for-x32.patch
|
||||
Patch4: 0004-libaio-makefile-add-D_FORTIFY_SOURCE-flag.patch
|
||||
Patch5: 0005-Fix-compile-error-that-exec-checking-need-super-priv.patch
|
||||
Patch6: 0006-libaio-Add-sw64-architecture.patch
|
||||
Patch7: 0007-Fix-build-error-if-compiler-is-clang.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
|
||||
@ -43,6 +44,7 @@ Files for libaio development
|
||||
%ifarch sw_64
|
||||
%patch6 -p1
|
||||
%endif
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
make
|
||||
@ -67,6 +69,9 @@ make check
|
||||
%attr(0755,root,root) %{_libdir}/libaio.so
|
||||
|
||||
%changelog
|
||||
* Wed Apr 05 2023 Chenxi Mao <chenxi.mao@suse.com> - 0.3.113-8
|
||||
- Fix build error if compiler is clang.
|
||||
|
||||
* Fri Mar 17 2023 laokz <zhangkai@iscas.ac.cn> - 0.3.113-7
|
||||
- remove patch2 arch-protection macro
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user