Henrik Nordstrom wrote:
tor 2009-10-01 klockan 16:47 +0200 skrev Kinkie:
ld: fatal: symbol `void operator delete[](void*)' is multiply-defined:
(file store.o type=FUNC; file SquidNew.o type=FUNC);
ld: fatal: symbol `void*operator new[](unsigned)' is multiply-defined:
(file store.o type=FUNC; file SquidNew.o type=FUNC);
ld: fatal: symbol `void operator delete(void*)' is multiply-defined:
(file debug.o type=FUNC; file SquidNew.o type=FUNC);
ld: fatal: symbol `void*operator new(unsigned)' is multiply-defined:
(file debug.o type=FUNC; file SquidNew.o type=FUNC);
ld: fatal: file processing errors. No output written to ufsdump
I can't find WHERE those may be multiply-defined. Any ideas?
include/SquidNew.h
Regards
Henrik
Defined in Squid.New.h. With an explicit instantiation in SquidNew.o AND
everywhere else when inlined.
The util.h piece looks like it should be mostly in the compat library
compat/os/sgi.h with just a wrapped include left there if needed.
** SquidNew.cc needs some better wrapping tests to ensure the functions
don't get defined there there when inlined.
And <new> needs to be tested by configure and safety-wrapped as well.
Does the attached patch change anything?
Amos
--
Please be using
Current Stable Squid 2.7.STABLE7 or 3.0.STABLE19
Current Beta Squid 3.1.0.14
=== modified file 'compat/os/sgi.h'
--- compat/os/sgi.h 2009-02-07 13:59:04 +0000
+++ compat/os/sgi.h 2009-10-02 00:39:28 +0000
@@ -21,6 +21,14 @@
#define _ABI_SOURCE
#endif /* USE_ASYNC_IO */
+/*
+ * The gcc compiler treats extern inline functions as being extern,
+ * while the SGI MIPSpro compilers treat them as inline. To get equivalent
+ * behavior, we must remove the inline keyword.
+ */
+#if defined(__cplusplus) && !defined(_GNUC_) && !defined(_SQUID_EXTERNNEW_)
+#define _SQUID_EXTERNNEW_ extern
+#endif
#endif /* _SQUID_SGI_ */
#endif /* SQUID_OS_SGI_H */
=== modified file 'configure.in'
--- configure.in 2009-09-25 04:13:50 +0000
+++ configure.in 2009-10-02 00:36:43 +0000
@@ -2409,6 +2409,7 @@
netinet/in.h \
netinet/in_systm.h \
netinet/ip_fil_compat.h \
+ new \
openssl/err.h \
openssl/md5.h \
openssl/ssl.h \
=== modified file 'include/SquidNew.h'
--- include/SquidNew.h 2009-01-21 03:47:47 +0000
+++ include/SquidNew.h 2009-10-02 00:36:10 +0000
@@ -33,15 +33,38 @@
#ifndef SQUID_NEW_H
#define SQUID_NEW_H
+/* for compatibility overloads */
+#include "config.h"
+
+/* for xmalloc and xfree functions */
#include "util.h"
+#if defined(__cplusplus)
+/*
+ * Any code using libstdc++ must have externally resolvable overloads
+ * for void * operator new - which means in the .o for the binary,
+ * or in a shared library. static libs don't propogate the symbol
+ * so, look in the translation unit containing main() in squid
+ * for the extern version in squid
+ */
+
+// Assume inline unless the macro is already defined...
+#ifndef _SQUID_EXTERNNEW_
+#ifdef __GNUC_STDC_INLINE__
+#define _SQUID_EXTERNNEW_ extern inline __attribute__((gnu_inline))
+#else
+#define _SQUID_EXTERNNEW_ extern inline
+#endif
+
/* Any code using libstdc++ must have externally resolvable overloads
* for void * operator new - which means in the .o for the binary,
* or in a shared library. static libs don't propogate the symbol
* so, look in the translation unit containing main() in squid
* for the extern version in squid
*/
+#HAVE_NEW
#include <new>
+#endif
_SQUID_EXTERNNEW_ void *operator new(size_t size) throw (std::bad_alloc)
{
@@ -60,4 +83,6 @@
xfree (address);
}
+#endif /* not __cplusplus */
+
#endif /* SQUID_NEW_H */
=== modified file 'include/util.h'
--- include/util.h 2009-03-06 13:26:57 +0000
+++ include/util.h 2009-10-02 00:29:43 +0000
@@ -72,32 +72,8 @@
SQUIDCEXTERN void Tolower(char *);
SQUIDCEXTERN void xfree(void *);
SQUIDCEXTERN void xxfree(const void *);
-#ifdef __cplusplus
-/*
- * Any code using libstdc++ must have externally resolvable overloads
- * for void * operator new - which means in the .o for the binary,
- * or in a shared library. static libs don't propogate the symbol
- * so, look in the translation unit containing main() in squid
- * for the extern version in squid
- */
-#ifndef _SQUID_EXTERNNEW_
-#if defined(_SQUID_SGI_) && !defined(_GNUC_)
-/*
- * The gcc compiler treats extern inline functions as being extern,
- * while the SGI MIPSpro compilers treat them as inline. To get equivalent
- * behavior, remove the inline keyword.
- */
-#define _SQUID_EXTERNNEW_ extern
-#else
-#ifdef __GNUC_STDC_INLINE__
-#define _SQUID_EXTERNNEW_ extern inline __attribute__((gnu_inline))
-#else
-#define _SQUID_EXTERNNEW_ extern inline
-#endif
-#endif
-#endif
+
#include "SquidNew.h"
-#endif
/* rfc1738.c */
SQUIDCEXTERN char *rfc1738_escape(const char *);