Browse Source

use hardened LDFLAGS

Praveen Arimbrathodiyil 11 years ago
parent
commit
232d5a37fc
2 changed files with 38 additions and 0 deletions
  1. 1 0
      debian/patches/series
  2. 37 0
      debian/patches/use-ldflags.patch

+ 1 - 0
debian/patches/series

@@ -0,0 +1 @@
+use-ldflags.patch

+ 37 - 0
debian/patches/use-ldflags.patch

@@ -0,0 +1,37 @@
+Description: Use hardened LDFLAGS
+ Add "read-only relocation" link flag when building library
+Author: Praveen Arimbrathodiyil <praveen@debian.org>
+Last-Update: 2013-06-13
+
+--- a/Makefile
++++ b/Makefile
+@@ -11,6 +11,7 @@
+ CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
+ CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
+ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
++LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS)
+ 
+ test: test_g test_fast
+ 	./test_g
+@@ -32,7 +33,7 @@
+ 	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@
+ 
+ http_parser.o: http_parser.c http_parser.h Makefile
+-	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
++	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $(LDFLAGS) -c http_parser.c
+ 
+ test-run-timed: test_fast
+ 	while(true) do time ./test_fast > /dev/null; done
+@@ -41,10 +42,10 @@
+ 	valgrind ./test_g
+ 
+ libhttp_parser.o: http_parser.c http_parser.h Makefile
+-	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
++	$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) $(LDFLAGS) -c http_parser.c -o libhttp_parser.o
+ 
+ library: libhttp_parser.o
+-	$(CC) -shared -o libhttp_parser.so libhttp_parser.o
++	$(CC) $(LDFLAGS) -shared -o libhttp_parser.so libhttp_parser.o
+ 
+ package: http_parser.o
+ 	$(AR) rcs libhttp_parser.a http_parser.o