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