From: Amos Jeffries Date: Thu, 12 Dec 2013 09:41:39 +0000 (-0800) Subject: Fix linker errors "relocation R_X86_64_32 against .rodata" X-Git-Tag: SQUID_3_5_0_1~461 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4de1e2da715c0be7c7ca1163542904df3e3e60be;p=thirdparty%2Fsquid.git Fix linker errors "relocation R_X86_64_32 against .rodata" ... "can not be used when making a shared object; recompile with -fPIC" Caused by some libraries built without libtool in certain environments. NP: there are other libraries in Squid built without libtool but they appear not to be having these linker issues at this time. Also, fixes "undefined symbol eui64_aton" uncovered by these changes. --- diff --git a/compat/Makefile.am b/compat/Makefile.am index bbd27cb3bc..22ffcf8cdd 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -9,8 +9,8 @@ include $(top_srcdir)/src/Common.am # Port Specific Configurations -noinst_LIBRARIES = libcompat-squid.a -libcompat_squid_a_SOURCES = \ +noinst_LTLIBRARIES = libcompat-squid.la +libcompat_squid_la_SOURCES = \ assert.cc \ assert.h \ cmsg.h \ @@ -23,6 +23,7 @@ libcompat_squid_a_SOURCES = \ debug.h \ drand48.h \ eui64_aton.h \ + eui64_aton.c \ fdsetsize.h \ getaddrinfo.h \ getnameinfo.h \ @@ -74,7 +75,7 @@ libcompat_squid_a_SOURCES = \ os/solaris.h \ os/sunos.h -libcompat_squid_a_LIBADD= $(LIBOBJS) +libcompat_squid_la_LIBADD= $(LIBOBJS) check_PROGRAMS += testPreCompiler TESTS += testPreCompiler diff --git a/compat/eui64_aton.c b/compat/eui64_aton.c index 2f1cf2d139..0a0bef7fc1 100644 --- a/compat/eui64_aton.c +++ b/compat/eui64_aton.c @@ -77,6 +77,8 @@ #include "squid.h" #include "compat/eui64_aton.h" +#if SQUID_EUI64_ATON + /* * Convert an ASCII representation of an EUI-64 to binary form. */ @@ -132,3 +134,5 @@ good: return (0); } + +#endif /* !SQUID_EUI64_ATON */ diff --git a/compat/eui64_aton.h b/compat/eui64_aton.h index 863a832e33..f73765a1ab 100644 --- a/compat/eui64_aton.h +++ b/compat/eui64_aton.h @@ -46,6 +46,8 @@ extern "C" { #endif +#define SQUID_EUI64_ATON 1 + /** * Size of the ASCII representation of an EUI-64. */ diff --git a/configure.ac b/configure.ac index d88e661c0d..4fd8209975 100644 --- a/configure.ac +++ b/configure.ac @@ -1126,7 +1126,7 @@ SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes}, [Define to enable SNMP monitoring of Squid]) AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"]) if test "x$enable_snmp" = "xyes"; then - SNMPLIB='../lib/snmplib/libsnmplib.a' + SNMPLIB='../lib/snmplib/libsnmplib.la' makesnmplib=snmplib fi AC_MSG_NOTICE([SNMP support enabled: $enable_snmp]) @@ -3016,6 +3016,7 @@ AC_CHECK_FUNCS(\ bswap_32 \ bswap16 \ bswap32 \ + eui64_aton \ fchmod \ getdtablesize \ getpagesize \ @@ -3073,7 +3074,6 @@ AC_CHECK_FUNCS(\ dnl ... and some we provide local replacements for AC_REPLACE_FUNCS(\ drand48 \ - eui64_aton \ inet_ntop \ inet_pton \ initgroups \ diff --git a/lib/snmplib/Makefile.am b/lib/snmplib/Makefile.am index 391e10464a..11a255c0ec 100644 --- a/lib/snmplib/Makefile.am +++ b/lib/snmplib/Makefile.am @@ -4,8 +4,8 @@ ## AM_CFLAGS = $(SQUID_CFLAGS) AM_CXXFLAGS = $(SQUID_CXXFLAGS) -noinst_LIBRARIES = libsnmplib.a -libsnmplib_a_SOURCES = asn1.c parse.c snmp_vars.c \ +noinst_LTLIBRARIES = libsnmplib.la +libsnmplib_la_SOURCES = asn1.c parse.c snmp_vars.c \ coexistance.c snmp_api.c snmp_error.c \ mib.c snmp_api_error.c \ snmp_msg.c \ diff --git a/src/Common.am b/src/Common.am index 036d501c9c..c78fe2bd9a 100644 --- a/src/Common.am +++ b/src/Common.am @@ -43,7 +43,7 @@ LIBPROFILER= endif ## Because compatibility is almost universal. And the link order is important. -COMPAT_LIB = -L$(top_builddir)/compat -lcompat-squid $(LIBPROFILER) +COMPAT_LIB = $(top_builddir)/compat/libcompat-squid.la $(LIBPROFILER) ## Some helpers are written in Perl and need the local shell defined properly subst_perlshell = sed -e 's,[@]PERL[@],$(PERL),g' <$(srcdir)/$@.pl.in >$@ || ($(RM) -f $@ ; exit 1) diff --git a/src/Makefile.am b/src/Makefile.am index 191c6de5a2..8029aff9e6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -922,7 +922,7 @@ DEFAULT_ERROR_DIR = $(datadir)/errors # Make location configure settings available to the code DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\" -snmp_core.o snmp_agent.o: ../lib/snmplib/libsnmplib.a $(top_srcdir)/include/cache_snmp.h +snmp_core.o snmp_agent.o: ../lib/snmplib/libsnmplib.la $(top_srcdir)/include/cache_snmp.h globals.cc: globals.h mk-globals-c.awk $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ || ($(RM) -f $@ && exit 1)