xref: /OK3568_Linux_fs/buildroot/package/libopenh264/0002-fix-mips-build.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom 9d5981eecde2133b9d6099eb99f96b1c29c3e520 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Bernd Kuhls <bernd.kuhls@t-online.de>
3*4882a593SmuzhiyunDate: Mon, 13 Apr 2020 12:03:01 +0200
4*4882a593SmuzhiyunSubject: [PATCH] fix mips build
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunIn total three PR were sent upstream to fix mips builds:
7*4882a593Smuzhiyunhttps://github.com/cisco/openh264/pull/3185
8*4882a593Smuzhiyunhttps://github.com/cisco/openh264/pull/3217
9*4882a593Smuzhiyunhttps://github.com/cisco/openh264/pull/3225
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunBuildroot used the first version
12*4882a593Smuzhiyunhttps://git.buildroot.net/buildroot/commit/package/libopenh264?id=e8d0df569e1844f7ba28918a53ee38027b325b8f
13*4882a593Smuzhiyundownloaded from https://github.com/cisco/openh264/pull/3185
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunDuring discussion the gcc option '-march=loongson3a' was changed to
16*4882a593Smuzhiyun'-Wa,-mloongson-mmi,-mloongson-ext':
17*4882a593Smuzhiyunhttps://github.com/cisco/openh264/pull/3185#discussion_r337818960
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThis causes build errors with gcc version 8.3.0 (Buildroot 2020.02)
20*4882a593Smuzhiyun
21*4882a593Smuzhiyuntmp/cctgEQaw.s:662: Error: opcode not supported on this processor: loongson3a (mips64r2) `bc .L22'
22*4882a593Smuzhiyun/tmp/cctgEQaw.s:1679: Error: opcode not supported on this processor: loongson3a (mips64r2) `bc .L27'
23*4882a593Smuzhiyun/tmp/cctgEQaw.s:2218: Error: opcode not supported on this processor: loongson3a (mips64r2) `jrc $31'
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunThis patch partly reverts the change to fix mips build.
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun$ /home/bernd/buildroot/br5/output/host/bin/mips64el-linux-gcc -v
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunUsing built-in specs.
30*4882a593SmuzhiyunCOLLECT_GCC=/home/bernd/buildroot/br5/output/host/opt/ext-toolchain/bin/mips64el-linux-gcc.br_real
31*4882a593SmuzhiyunCOLLECT_LTO_WRAPPER=/home/bernd/buildroot/br5/output/host/opt/ext-toolchain/bin/../libexec/gcc/mips64el-buildroot-linux-gnu/8.3.0/lto-wrapper
32*4882a593SmuzhiyunTarget: mips64el-buildroot-linux-gnu
33*4882a593SmuzhiyunConfigured with: ./configure --prefix=/opt/br-mips64r6-n64-el-hf-2020.02 --sysconfdir=/opt/br-mips64r6-n64-el-hf-2020.02/etc --enable-static --target=mips64el-buildroot-linux-gnu --with-sysroot=/opt/br-mips64r6-n64-el-hf-2020.02/mips64el-buildroot-linux-gnu/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/opt/br-mips64r6-n64-el-hf-2020.02 --with-mpc=/opt/br-mips64r6-n64-el-hf-2020.02 --with-mpfr=/opt/br-mips64r6-n64-el-hf-2020.02 --with-pkgversion='Buildroot 2020.02' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --enable-tls --enable-threads --without-isl --without-cloog --with-arch=mips64r6 --with-abi=64 --with-nan=2008 --enable-languages=c,c++ --with-build-time-tools=/opt/br-mips64r6-n64-el-hf-2020.02/mips64el-buildroot-linux-gnu/bin --enable-shared --disable-libgomp
34*4882a593SmuzhiyunThread model: posix
35*4882a593Smuzhiyungcc version 8.3.0 (Buildroot 2020.02)
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunPatch sent upstream: https://github.com/cisco/openh264/pull/3267
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunSigned-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
40*4882a593Smuzhiyun---
41*4882a593Smuzhiyun build/arch.mk            | 2 +-
42*4882a593Smuzhiyun build/mips-simd-check.sh | 2 +-
43*4882a593Smuzhiyun 2 files changed, 2 insertions(+), 2 deletions(-)
44*4882a593Smuzhiyun
45*4882a593Smuzhiyundiff --git a/build/arch.mk b/build/arch.mk
46*4882a593Smuzhiyunindex 1bf318ab..c6570ed4 100644
47*4882a593Smuzhiyun--- a/build/arch.mk
48*4882a593Smuzhiyun+++ b/build/arch.mk
49*4882a593Smuzhiyun@@ -41,7 +41,7 @@ ASMFLAGS += -I$(SRC_PATH)codec/common/mips/
50*4882a593Smuzhiyun ifeq ($(ENABLE_MMI), Yes)
51*4882a593Smuzhiyun ENABLE_MMI = $(shell $(SRC_PATH)build/mips-simd-check.sh $(CC) mmi)
52*4882a593Smuzhiyun ifeq ($(ENABLE_MMI), Yes)
53*4882a593Smuzhiyun-CFLAGS += -DHAVE_MMI -Wa,-mloongson-mmi,-mloongson-ext
54*4882a593Smuzhiyun+CFLAGS += -DHAVE_MMI -march=loongson3a
55*4882a593Smuzhiyun endif
56*4882a593Smuzhiyun endif
57*4882a593Smuzhiyun #msa
58*4882a593Smuzhiyundiff --git a/build/mips-simd-check.sh b/build/mips-simd-check.sh
59*4882a593Smuzhiyunindex 5efffbef..d0d72f9e 100755
60*4882a593Smuzhiyun--- a/build/mips-simd-check.sh
61*4882a593Smuzhiyun+++ b/build/mips-simd-check.sh
62*4882a593Smuzhiyun@@ -15,7 +15,7 @@ TMPO=$(mktemp tmp.XXXXXX.o)
63*4882a593Smuzhiyun if [ $2 == "mmi" ]
64*4882a593Smuzhiyun then
65*4882a593Smuzhiyun    echo "void main(void){ __asm__ volatile(\"punpcklhw \$f0, \$f0, \$f0\"); }" > $TMPC
66*4882a593Smuzhiyun-   $1 -Wa,-mloongson-mmi $TMPC -o $TMPO &> /dev/null
67*4882a593Smuzhiyun+   $1 -march=loongson3a $TMPC -o $TMPO &> /dev/null
68*4882a593Smuzhiyun    if test -s $TMPO
69*4882a593Smuzhiyun    then
70*4882a593Smuzhiyun       echo "Yes"
71*4882a593Smuzhiyun--
72*4882a593Smuzhiyun2.25.0
73*4882a593Smuzhiyun
74