diff --git a/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch b/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch index b71d03e8d717ce0641c3aeb5c3e613a85bd59a65..98b15aa1e7494b5920c32b0a5289ee0b6d9871b6 100644 --- a/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch +++ b/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch @@ -3,79 +3,91 @@ From: jiangheng Date: Thu, 11 Jan 2024 16:10:57 +0800 Subject: [PATCH] add securec compile option and fPIC option ---- - app/meson.build | 2 ++ - buildtools/chkincs/meson.build | 2 ++ - drivers/meson.build | 2 ++ - examples/meson.build | 2 ++ - lib/meson.build | 2 ++ - 5 files changed, 10 insertions(+) - diff --git a/app/meson.build b/app/meson.build -index 8aaed59..e22bbb2 100644 +index 8aaed59..7120c55 100644 --- a/app/meson.build +++ b/app/meson.build -@@ -43,6 +43,8 @@ if get_option('tests') +@@ -43,7 +43,14 @@ if get_option('tests') endif default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] -+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] -+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++default_cflags += ['-fPIE', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] default_ldflags = [] ++if meson.get_compiler('c').get_id() == 'clang' ++ default_ldflags = ['-pie', '-Wl,-z,relro,-z,now,-z,noexecstack'] ++else ++ default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++endif ++ if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] + endif diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build -index f2dadca..98dae23 100644 +index f2dadca..91795bd 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build -@@ -14,6 +14,8 @@ gen_c_files = generator(gen_c_file_for_header, - cflags = machine_args +@@ -15,6 +15,12 @@ cflags = machine_args cflags += '-DALLOW_EXPERIMENTAL_API' cflags += '-DALLOW_INTERNAL_API' -+cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] -+cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++cflags += ['-fPIE', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] ++if meson.get_compiler('c').get_id() == 'clang' ++ ldflags = ['-pie', '-Wl,-z,relro,-z,now,-z,noexecstack'] ++else ++ cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++endif sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) + diff --git a/drivers/meson.build b/drivers/meson.build -index 5ba5340..1891192 100644 +index 5ba5340..007e271 100644 --- a/drivers/meson.build +++ b/drivers/meson.build -@@ -57,6 +57,8 @@ enable_drivers += always_enable - default_cflags = machine_args +@@ -58,6 +58,12 @@ default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] default_cflags += ['-DALLOW_INTERNAL_API'] -+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] -+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++default_cflags += ['-fPIE', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] ++if meson.get_compiler('c').get_id() == 'clang' ++ default_ldflags = ['-pie', '-Wl,-z,relro,-z,now,-z,noexecstack'] ++else ++ default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++endif if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' + endif diff --git a/examples/meson.build b/examples/meson.build -index 8e8968a..51c975d 100644 +index 8e8968a..a290cc8 100644 --- a/examples/meson.build +++ b/examples/meson.build -@@ -86,6 +86,8 @@ default_ldflags = dpdk_extra_ldflags - if get_option('default_library') == 'static' and not is_windows +@@ -87,6 +87,12 @@ if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] endif -+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] -+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++default_cflags += ['-fPIE', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] ++if meson.get_compiler('c').get_id() == 'clang' ++ default_ldflags = ['-pie', '-Wl,-z,relro,-z,now,-z,noexecstack'] ++else ++ default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++endif foreach example: examples name = example.split('/')[-1] + build = true diff --git a/lib/meson.build b/lib/meson.build -index 6c143ce..65cc38a 100644 +index 6c143ce..8eed201 100644 --- a/lib/meson.build +++ b/lib/meson.build -@@ -143,6 +143,8 @@ enable_libs += always_enable - default_cflags = machine_args +@@ -144,6 +144,12 @@ default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] default_cflags += ['-DALLOW_INTERNAL_API'] -+default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] -+default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++default_cflags += ['-fPIE', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall'] ++if meson.get_compiler('c').get_id() == 'clang' ++ default_ldflags = ['-pie', '-Wl,-z,relro,-z,now,-z,noexecstack'] ++else ++ default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] ++endif if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' --- -2.33.0 + endif diff --git a/dpdk.spec b/dpdk.spec index a635f3da3d21016b34814a2eba7b51a3ee409130..9f73c205c2170f055c2735b4239d37f4bdc8e981 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -70,7 +70,8 @@ License: BSD and LGPLv2 and GPLv2 # ExclusiveArch: x86_64 i686 aarch64 ppc64le loongarch64 riscv64 -BuildRequires: gcc + +BuildRequires: gcc lld ninja-build BuildRequires: kernel-headers, kernel-devel, libpcap-devel, zlib-devel BuildRequires: numactl-devel BuildRequires: rdma-core-devel @@ -156,6 +157,9 @@ end %autosetup -n %{name}-%{version} -S git_am %build +%if "%toolchain" == "clang" +export LLVM=1 +%endif CFLAGS="$(echo %{optflags} -fcommon)" \ %meson --includedir=include/dpdk \ -Ddrivers_install_subdir=dpdk-pmds \ @@ -216,6 +220,10 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko %endif %changelog +* Wed Mar 27 2024 tiberium - 23.11-7 + 1.fix symbol check issue of meson due to clang compile failed + 2.fix clang build error by kernel update + * Fri Mar 29 2024 zhangmengxuan - 23.11-7 Add add-rte_eth_bond_link_monitoring_get API in map