Fix passing of CFLAGS to brp-llvm-compile-lto-elf
This was accidentally broken by d9c7e4eef8
.
This commit is contained in:
parent
9a1b602bdb
commit
f77dcdec18
@ -12,6 +12,9 @@ check_convert_bitcode () {
|
|||||||
local file_name=$(realpath ${1})
|
local file_name=$(realpath ${1})
|
||||||
local file_type=$(file ${file_name})
|
local file_type=$(file ${file_name})
|
||||||
|
|
||||||
|
shift
|
||||||
|
CLANG_FLAGS="$@"
|
||||||
|
|
||||||
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
||||||
# check for an indication that the bitcode was
|
# check for an indication that the bitcode was
|
||||||
# compiled with -flto
|
# compiled with -flto
|
||||||
@ -29,7 +32,7 @@ check_convert_bitcode () {
|
|||||||
pushd ${archive_stage}
|
pushd ${archive_stage}
|
||||||
ar x ${archive}
|
ar x ${archive}
|
||||||
for archived_file in $(find -not -type d); do
|
for archived_file in $(find -not -type d); do
|
||||||
check_convert_bitcode ${archived_file}
|
check_convert_bitcode ${archived_file} ${CLANG_FLAGS}
|
||||||
echo "Repacking ${archived_file} into ${archive}."
|
echo "Repacking ${archived_file} into ${archive}."
|
||||||
ar r ${archive} ${archived_file}
|
ar r ${archive} ${archived_file}
|
||||||
done
|
done
|
||||||
@ -40,4 +43,4 @@ check_convert_bitcode () {
|
|||||||
echo "Checking for LLVM bitcode artifacts"
|
echo "Checking for LLVM bitcode artifacts"
|
||||||
export -f check_convert_bitcode
|
export -f check_convert_bitcode
|
||||||
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -print0 | \
|
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -print0 | \
|
||||||
xargs -0 -n1 -P$NCPUS sh -c "check_convert_bitcode \$@" ARG0
|
xargs -0 -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# 2) When making changes, increment the version (in baserelease) by 1.
|
# 2) When making changes, increment the version (in baserelease) by 1.
|
||||||
# rpmdev-bumpspec and other tools update the macro below, which is used
|
# rpmdev-bumpspec and other tools update the macro below, which is used
|
||||||
# in Version: to get the desired effect.
|
# in Version: to get the desired effect.
|
||||||
%global baserelease 223
|
%global baserelease 224
|
||||||
|
|
||||||
Summary: Red Hat specific rpm configuration files
|
Summary: Red Hat specific rpm configuration files
|
||||||
Name: redhat-rpm-config
|
Name: redhat-rpm-config
|
||||||
@ -219,6 +219,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||||||
%doc buildflags.md
|
%doc buildflags.md
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 14 2022 Tom Stellard <tstellar@redhat.com> - 224-1
|
||||||
|
- Fix passing of CFLAGS to brp-llvm-compile-lto-elf
|
||||||
|
|
||||||
* Fri May 27 2022 Tom Stellard <tstellar@redhat.com> - 223-1
|
* Fri May 27 2022 Tom Stellard <tstellar@redhat.com> - 223-1
|
||||||
- Move -fno-openmp-implicit-rpath option from CFLAGS to LDFLAGS
|
- Move -fno-openmp-implicit-rpath option from CFLAGS to LDFLAGS
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void hello(void) {
|
||||||
|
printf("Hello, world!\n");
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
void hello(void);
|
@ -0,0 +1,34 @@
|
|||||||
|
Name: brp-llvm-compile-lto-elf-test-lib
|
||||||
|
Version: 1
|
||||||
|
Release: 1
|
||||||
|
Summary: Library package for testing brp-llvm-compile-lto-elf
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
BuildRequires: clang binutils
|
||||||
|
Source0: %{name}.c
|
||||||
|
Source1: %{name}.h
|
||||||
|
|
||||||
|
# FIXME: I'm not sure why this doesn't work
|
||||||
|
%undefine _package_note_file
|
||||||
|
|
||||||
|
%global toolchain clang
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
clang ${CFLAGS} -c %{SOURCE0} -o lib.o
|
||||||
|
ar cr %{name}.a lib.o
|
||||||
|
ranlib %{name}.a
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}%{_libdir}
|
||||||
|
mkdir -p %{buildroot}%{_includedir}
|
||||||
|
|
||||||
|
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.a
|
||||||
|
%{__install} -p -m 644 -t %{buildroot}%{_includedir} %{SOURCE1}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_libdir}/%{name}.a
|
||||||
|
%{_includedir}/%{name}.h
|
@ -0,0 +1,6 @@
|
|||||||
|
#include <brp-llvm-compile-lto-elf-test-lib.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
hello();
|
||||||
|
return 0;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
Name: brp-llvm-compile-lto-elf-test
|
||||||
|
Version: 1
|
||||||
|
Release: 1
|
||||||
|
Summary: Library package for testing brp-llvm-compile-lto-elf
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
BuildRequires: gcc
|
||||||
|
BuildRequires: brp-llvm-compile-lto-elf-test-lib
|
||||||
|
|
||||||
|
Source0: %{name}.c
|
||||||
|
|
||||||
|
# FIXME: I'm not sure why this doesn't work
|
||||||
|
%undefine _package_note_file
|
||||||
|
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}
|
||||||
|
|
||||||
|
%build
|
||||||
|
gcc ${CFLAGS} -c %{SOURCE0} -o %{name}.o
|
||||||
|
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.a -o %{name}
|
||||||
|
|
||||||
|
%check
|
||||||
|
./%{name} | grep "Hello, world!"
|
8
tests/brp-llvm-compile-lto-elf/main.fmf
Normal file
8
tests/brp-llvm-compile-lto-elf/main.fmf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Summary: Test that the brp-llvm-compile-lto-elf script is working correctly
|
||||||
|
|
||||||
|
require:
|
||||||
|
- dnf-plugins-core
|
||||||
|
- redhat-rpm-config
|
||||||
|
- rpm-build
|
||||||
|
|
||||||
|
test: ./runtest.sh
|
17
tests/brp-llvm-compile-lto-elf/runtest.sh
Executable file
17
tests/brp-llvm-compile-lto-elf/runtest.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
lib_dir=brp-llvm-compile-lto-elf-test-lib
|
||||||
|
lib_spec=$lib_dir/brp-llvm-compile-lto-elf-test-lib.spec
|
||||||
|
|
||||||
|
dnf -y build-dep $lib_spec
|
||||||
|
rpmbuild --define "_sourcedir ." --define "_builddir ./$lib_dir" --define "_rpmdir ." -bb $lib_spec
|
||||||
|
|
||||||
|
dnf -y install ./`rpm --eval '%{_arch}'`/*.rpm
|
||||||
|
|
||||||
|
test_dir=brp-llvm-compile-lto-elf-test
|
||||||
|
test_spec=$test_dir/brp-llvm-compile-lto-elf-test.spec
|
||||||
|
|
||||||
|
dnf -y build-dep $test_spec
|
||||||
|
rpmbuild --define "_sourcedir ." --define "_builddir ./$test_dir" -bi $test_spec
|
Loading…
Reference in New Issue
Block a user