File mhvtl-fix-ppc-Makefile.patch of Package mhvtl.openSUSE_Leap_15.2_Update

From: Lee Duncan <lduncan@suse.com>
Date: Fri Nov 15 09:13:32 PST 2019
Subject: [PATCH] mhvtl: fix ppc Makefile

Fix the Makefile in usr so that the dump_tape command can
compile on ppcle64. Otherwise, you get errors like:

> [   74s] cc -Wall -Wshadow -g -O2 -D_LARGEFILE64_SOURCE -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -I../kernel -DMHVTL_VERSION=\"1.62_release\" -D_GNU_SOURCE -DMHVTL_DEBUG -DMHVTL_HOME_PATH=\"/var/lib/mhvtl\" -DMHVTL_CONFIG_PATH=\"/etc/mhvtl\" -o dump_tape libcrc32c.o dump_tape.o minilzo.o -L. \
> [   74s] 	-lz -L. -lvtlcart -lvtlscsi
> [   75s] /usr/lib64/gcc/aarch64-suse-linux/9/../../../../aarch64-suse-linux/bin/ld: /tmp/dump_tape.H3eQFB.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `c_pos' which may bind externally can not be used when making a shared object; recompile with -fPIC
> [   75s] /usr/lib64/gcc/aarch64-suse-linux/9/../../../../aarch64-suse-linux/bin/ld: /tmp/dump_tape.H3eQFB.ltrans0.ltrans.o(.text.startup+0x590): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `c_pos'
> [   75s] /usr/lib64/gcc/aarch64-suse-linux/9/../../../../aarch64-suse-linux/bin/ld: final link failed: bad value
> [   75s] collect2: error: ld returned 1 exit status
> [   75s] make[1]: *** [Makefile:96: dump_tape] Error 1
> [   75s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/mhvtl-1.62_release/usr'
> [   75s] make: *** [Makefile:56: usr] Error 2

---
diff -aurp mhvtl-1.62_release.orig/usr/Makefile mhvtl-1.62_release/usr/Makefile
--- mhvtl-1.62_release.orig/usr/Makefile	2019-11-15 09:02:53.367425882 -0800
+++ mhvtl-1.62_release/usr/Makefile	2019-11-15 09:03:36.567320318 -0800
@@ -90,11 +90,14 @@ vtlcmd:	vtlcmd.o
 minilzo.o:	minilzo.c lzoconf.h lzodefs.h
 	$(CC) $(CFLAGS) $(LZODEBUG) -o minilzo.o -c minilzo.c
 
+dump_tape.o:	dump_tape.c
+	$(CC) $(CFLAGS) -c -fPIC $?
+
 dump_tape:	dump_tape.o vtlcart.o libvtlscsi.so vtltape.h scsi.h \
 		../kernel/vtl_common.h minilzo.c minilzo.h minilzo.o \
 		crc32c.h libcrc32c.o libcrc32c.c
 	$(CC) $(CFLAGS) -o dump_tape libcrc32c.o dump_tape.o minilzo.o -L. \
-		-lz -L. -lvtlcart -lvtlscsi
+		-lz -L. -lvtlcart -lvtlscsi -fPIC
 
 mktape:		mktape.c mktape.o vtlcart.o libvtlscsi.so vtltape.h vtllib.h \
 		../kernel/vtl_common.h
openSUSE Build Service is sponsored by