Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jun 2010 11:25:58 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        gecko@FreeBSD.org
Subject:   gecko ports vs gcc44
Message-ID:  <4C061596.1010500@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

I think I found a workaround for linkage problems in gecko ports (firefox,
libxul, ...) when gcc 4.4 is used for build.  However, I don't understand exact
details of what is happening.

First, the error:
jsnum.o: In function `js_InitNumberClass':

jsnum.cpp:(.text+0x1176): undefined reference to `fedisableexcept'

jsnum.o: In function `js_InitRuntimeNumberState':

jsnum.cpp:(.text+0x18f8): undefined reference to `fedisableexcept'

/usr/local/bin/ld: libmozjs.so: hidden symbol `fedisableexcept' isn't defined

/usr/local/bin/ld: final link failed: Nonrepresentable section on output

collect2: ld returned 1 exit status


I determined that it is undefined reference in jsnum.o that is marked hidden and
that causes linker to not resolve it via libm where it is defined.
With base gacc there is no problem here, but gcc44 somehow thinks that this
symbol should be marked hidden...

I tracked this to gcc_hidden.h that are being included into almost every
compilation unit (including jsnum.cpp) via -include command line option.
gcc_hidden.h has in it:
#pragma GCC visibility push(hidden)

Some info on the pragma:
http://gcc.gnu.org/wiki/Visibility
http://gcc.gnu.org/onlinedocs/gcc/Visibility-Pragmas.html

My current workaround is to find all gcc_hidden.h in the source and drop that
pragma line.  I feel that we need to call in a gcc expert, because I am not sure
why that pragma causes problems for us, but not e.g. for Linux people.  I am
sure that they've been using gcc 4.4 to compile firefox for quite a while.

I also tried the following patch.
It worked with libxul and firefox35, but the latter still has another unresolved
problem.  This patch just demonstrates the scope of the problem and also fixes a
missing include in nsStackWalk.cpp.

--- mozilla-1.9.1/js/src/jsnum.cpp.orig	2010-06-02 10:03:11.599506022 +0300
+++ mozilla-1.9.1/js/src/jsnum.cpp	2010-06-02 10:03:47.561566932 +0300
@@ -667,7 +667,9 @@
 #else

 #if defined(__FreeBSD__) && __FreeBSD_version >= 601000
+#pragma GCC visibility push(default)
 #include <fenv.h>
+#pragma GCC visibility pop
 #define FIX_FPU() (fedisableexcept(FE_ALL_EXCEPT))

 #else
--- mozilla-1.9.1/xpcom/io/nsNativeCharsetUtils.cpp.orig	2010-06-02
10:10:07.381959744 +0300
+++ mozilla-1.9.1/xpcom/io/nsNativeCharsetUtils.cpp	2010-06-02
10:11:05.461815747 +0300
@@ -132,7 +132,9 @@
 #if defined(USE_ICONV)
 #include <nl_types.h> // CODESET
 #include <langinfo.h> // nl_langinfo
+#pragma GCC visibility push(default)
 #include "/usr/local/include/iconv.h"    // iconv_open, iconv, iconv_close
+#pragma GCC visibility pop
 #include <errno.h>
 #include "plstr.h"

--- mozilla-1.9.1/xpcom/base/nsStackWalk.cpp.orig	2010-06-02 10:15:18.256096845
+0300
+++ mozilla-1.9.1/xpcom/base/nsStackWalk.cpp	2010-06-02 10:14:53.493449463 +0300
@@ -40,6 +40,8 @@

 /* API for getting a stack trace of the C/C++ stack on the current thread */

+#include <dlfcn.h>
+
 #include "nsStackWalk.h"

 #if defined(_WIN32) && (defined(_M_IX86) || defined(_M_AMD64) ||
defined(_M_IA64)) && !defined(WINCE) // WIN32 x86 stack walking code

-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C061596.1010500>