Blame SOURCES/net-snmp-5.7-relro.patch

8a419f
725657: net-snmp should be compiled with relro
8a419f
8a419f
This patch probably won't get ever upstream. It ensures that relro options [1]
8a419f
are propagated where appropriate.
8a419f
8a419f
[1]: configure --with-ldflags="-Wl,-z,relro -Wl,-z,now"
8a419f
8a419f
diff -up net-snmp-5.7.2.pre2/apps/Makefile.in.rhel net-snmp-5.7.2.pre2/apps/Makefile.in
8a419f
--- net-snmp-5.7.2.pre2/apps/Makefile.in.rhel	2012-07-31 14:00:04.051915227 +0200
8a419f
+++ net-snmp-5.7.2.pre2/apps/Makefile.in	2012-07-31 14:00:05.506909768 +0200
8a419f
@@ -204,7 +204,7 @@ snmpdf$(EXEEXT):    snmpdf.$(OSUFFIX) $(
8a419f
 	$(LINK) ${CFLAGS} -o $@ snmpdf.$(OSUFFIX) ${LDFLAGS} ${LIBS}
8a419f
 
8a419f
 libnetsnmptrapd.$(LIB_EXTENSION)$(LIB_VERSION): $(LLIBTRAPD_OBJS)
8a419f
-	$(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS)
8a419f
+	$(LIB_LD_CMD) $@ ${LLIBTRAPD_OBJS} $(MIBLIB) $(USELIBS) $(PERLLDOPTS_FOR_LIBS) $(LIB_LD_LIBS) ${LDFLAGS}
8a419f
 	$(RANLIB) $@
8a419f
 
8a419f
 snmpinforminstall:
8a419f
diff -up net-snmp-5.7.2.pre2/perl/agent/default_store/Makefile.PL.rhel net-snmp-5.7.2.pre2/perl/agent/default_store/Makefile.PL
8a419f
--- net-snmp-5.7.2.pre2/perl/agent/default_store/Makefile.PL.rhel	2012-07-12 04:23:25.000000000 +0200
8a419f
+++ net-snmp-5.7.2.pre2/perl/agent/default_store/Makefile.PL	2012-07-31 14:00:08.835898341 +0200
8a419f
@@ -69,6 +69,8 @@ sub InitMakeParams {
8a419f
     }
8a419f
     else {
8a419f
 	$opts = NetSNMPGetOpts("../../");
8a419f
+	$Params{'LDDLFLAGS'} = "$Config{lddlflags} " . `$opts->{'nsconfig'} --ldflags`;
8a419f
+	chomp($Params{'LDDLFLAGS'});
8a419f
 	$Params{'LIBS'}    = `$opts->{'nsconfig'} --libs`;
8a419f
 	chomp($Params{'LIBS'});
8a419f
 	$Params{'CCFLAGS'} = `$opts->{'nsconfig'} --cflags`;
8a419f
diff -up net-snmp-5.7.2.pre2/python/setup.py.rhel net-snmp-5.7.2.pre2/python/setup.py
8a419f
--- net-snmp-5.7.2.pre2/python/setup.py.rhel	2012-07-12 04:23:25.000000000 +0200
8a419f
+++ net-snmp-5.7.2.pre2/python/setup.py	2012-07-31 14:00:07.618902228 +0200
8a419f
@@ -18,14 +18,18 @@ if intree:
8a419f
     netsnmp_libs = os.popen(basedir+'/net-snmp-config --libs').read()
8a419f
     libdir = os.popen(basedir+'/net-snmp-config --build-lib-dirs '+basedir).read()
8a419f
     incdir = os.popen(basedir+'/net-snmp-config --build-includes '+basedir).read()
8a419f
+    ldflags = os.popen(basedir+'/net-snmp-config --ldflags').read()
8a419f
     libs = re.findall(r"-l(\S+)", netsnmp_libs)
8a419f
     libdirs = re.findall(r"-L(\S+)", libdir)
8a419f
     incdirs = re.findall(r"-I(\S+)", incdir)
8a419f
+    linkargs = ldflags.split()
8a419f
 else:
8a419f
     netsnmp_libs = os.popen('net-snmp-config --libs').read()
8a419f
+    ldflags = os.popen('net-snmp-config --ldflags').read()
8a419f
     libdirs = re.findall(r"-L(\S+)", netsnmp_libs)
8a419f
     incdirs = []
8a419f
     libs = re.findall(r"-l(\S+)", netsnmp_libs)
8a419f
+    linkargs = ldflags.split()
8a419f
 
8a419f
 setup(
8a419f
     name="netsnmp-python", version="1.0a1",
8a419f
@@ -41,6 +45,7 @@ setup(
8a419f
        Extension("netsnmp.client_intf", ["netsnmp/client_intf.c"],
8a419f
                  library_dirs=libdirs,
8a419f
                  include_dirs=incdirs,
8a419f
-                 libraries=libs )
8a419f
+                 libraries=libs,
8a419f
+                 extra_link_args=linkargs )
8a419f
        ]
8a419f
     )