SUGGEST: Patch for compiling unzip using hardened CFLAGS

Aki Tuomi cmouse at desteem.org
Mon Oct 10 06:48:39 PDT 2005


Attached, patch for compiling unzip under HLFS. Removes compilation of ASM
components and uses proper CFLAGS.
 
-- 
Aki Tuomi

-------------- next part --------------
Binary files old/unix/.Makefile.swp and new/unix/.Makefile.swp differ
diff -urN old/unix/Makefile new/unix/Makefile
--- old/unix/Makefile	2005-10-10 16:40:29.000000000 +0300
+++ new/unix/Makefile	2005-10-10 16:43:15.000000000 +0300
@@ -783,7 +783,7 @@
 # Linux (Posix, approximately SysV):  virtually any version since before 0.96,
 # for any platform.  Change "-O" to "-O3" or whatever, as desired...
 linux_noasm:	unix_make
-	$(MAKE) unzips CC=gcc LD=gcc CF="-O -Wall -I. $(LOC)"
+	$(MAKE) unzips CC=gcc LD="gcc -pie -fpie" CF="-O3 -Wall -I. $(LOC) -pie -fpie"
 
 # Linux with lcc compiler:  __inline__ (stat.h) not recognized, and must edit
 # /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined.  -O3
@@ -822,13 +822,13 @@
 # instead of the original UnZip version.  (libz was libgz prior to 0.94)
 linux_shlibz:	unix_make
 #	$(MAKE) objsdll CC=gcc CF="-O3 -Wall -I. -fPIC -DDLL -DUSE_ZLIB $(LOC)"
-	$(MAKE) objsdll CC=gcc AS=gcc AF="-fPIC -Di386 $(AF)" CRC32=crc_gcc\
-	 CF="-O3 -Wall -I. -fPIC -DDLL -DUSE_ZLIB -DASM_CRC $(LOC)"
-	ln -sf crc_gcc.pic.o crc32.pic.o
-	gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)
+	$(MAKE) objsdll unzips CC=gcc CRC32=crc32 CF="-O3 -Wall -I. -fPIC -DDLL -DUSE_ZLIB $(LOC) -fpie -pie"
+	#ln -sf crc_gcc.pic.o crc32.pic.o
+	gcc -shared -fPIC -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)
 	ln -sf libunzip.so.0.4 libunzip.so.0
-	gcc -c -O unzipstb.c
-	gcc -o unzip unzipstb.o -L. -lunzip -lz
+	ln -sf libunzip.so.0.4 libunzip.so
+	gcc -pie -fpie -c -O unzipstb.c
+	gcc -pie -fpie -O unzip -L. -lunzip -lz unzipstb.o
 
 # LynxOS-x86 2.3.0 and newer, a real-time BSD-like OS; uses gcc.
 lynx:		unix_make


More information about the hlfs-dev mailing list