Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moz_create_arena_with_params dynamic load error #35

Closed
kenz-gelsoft opened this issue May 7, 2023 · 9 comments
Closed

moz_create_arena_with_params dynamic load error #35

kenz-gelsoft opened this issue May 7, 2023 · 9 comments

Comments

@kenz-gelsoft
Copy link
Owner

We should use this implementation

from mozjemalloc.h

// Dummy implementation of the moz_arena_* API, falling back to a given
// implementation of the base allocator.
template <typename T>
struct DummyArenaAllocator {
  static arena_id_t moz_create_arena_with_params(arena_params_t*) { return 0; }

  static void moz_dispose_arena(arena_id_t) {}

#define MALLOC_DECL(name, return_type, ...)                 \
  static return_type moz_arena_##name(                      \
      arena_id_t, ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) { \
    return T::name(ARGS_HELPER(ARGS, ##__VA_ARGS__));       \
  }
#define MALLOC_FUNCS MALLOC_FUNCS_MALLOC_BASE
#include "malloc_decls.h"
};
@kenz-gelsoft
Copy link
Owner Author

no .so have this impl

~/src/firefox-102.9.0/obj-ff-dbg/dist/bin> for SO in *.so; do echo $SO; nm $SO | grep moz_create_arena_with_params; done
libipcclientcerts.so
liblgpllibs.so
libmozavcodec.so
libmozavutil.so
libmozgtk.so
libmozsqlite3.so
libmozwayland.so
libxul.so
                 w moz_create_arena_with_params

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented May 7, 2023

In working environment (aarch64 firefox-esr on debian on crostini on chromebook)

files

kenz@penguin:/usr/lib/firefox-esr$ ls *.so | cat
libfreeblpriv3.so
libipcclientcerts.so
liblgpllibs.so
libmozavcodec.so
libmozavutil.so
libmozgtk.so
libmozsandbox.so
libmozsqlite3.so
libmozwayland.so
libnspr4.so
libnss3.so
libnssckbi.so
libnssutil3.so
libplc4.so
libplds4.so
libsmime3.so
libsoftokn3.so
libssl3.so
libxul.so

all files stripped, so couldn't check how moz_create_arena_with_params live.

@kenz-gelsoft
Copy link
Owner Author

built here, but not linked?

~/src/firefox-102.9.0/obj-ff-dbg/memory> nm ./build/Unified_cpp_memory_build0.o
                 U calloc
                 U free
                 U malloc
                 U memalign
0000000000000000 T moz_arena_calloc
0000000000000000 T moz_arena_free
0000000000000000 T moz_arena_malloc
0000000000000000 T moz_arena_memalign
0000000000000000 T moz_arena_realloc
0000000000000000 T moz_create_arena_with_params
0000000000000000 T moz_dispose_arena
                 U realloc

@kenz-gelsoft
Copy link
Owner Author

diff --git a/build/gecko_templates.mozbuild b/build/gecko_templates.mozbuild
index 51aae5b870..f8d359f35f 100644
--- a/build/gecko_templates.mozbuild
+++ b/build/gecko_templates.mozbuild
@@ -41,7 +41,8 @@ def GeckoBinary(linkage='dependent', mozglue=None):
             USE_LIBS += ['mozglue']
             DEFINES['MOZ_HAS_MOZGLUE'] = True
             if CONFIG['MOZ_GLUE_IN_PROGRAM'] and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
-                LDFLAGS += ['-rdynamic']
+                #LDFLAGS += ['-rdynamic']
+                pass
         elif mozglue == 'library':
             LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
             if not CONFIG['MOZ_GLUE_IN_PROGRAM']:

@kenz-gelsoft
Copy link
Owner Author

diff --git a/build/gecko_templates.mozbuild b/build/gecko_templates.mozbuild
index 51aae5b870..5f0db3acdf 100644
--- a/build/gecko_templates.mozbuild
+++ b/build/gecko_templates.mozbuild
@@ -41,7 +41,9 @@ def GeckoBinary(linkage='dependent', mozglue=None):
             USE_LIBS += ['mozglue']
             DEFINES['MOZ_HAS_MOZGLUE'] = True
             if CONFIG['MOZ_GLUE_IN_PROGRAM'] and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
-                LDFLAGS += ['-rdynamic']
+                #LDFLAGS += ['-rdynamic']
+                LDFLAGS += ['-Wl,--export-all-symbols']
+                pass
         elif mozglue == 'library':
             LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
             if not CONFIG['MOZ_GLUE_IN_PROGRAM']:

this didn't help

 1:46.64 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: unrecognized option '--export-all-symbols'
 1:46.64 /boot/system/develop/tools/bin/../lib/gcc/x86_64-unknown-haiku/11.2.0/../../../../x86_64-unknown-haiku/bin/ld: use the --help option for usage information
 1:46.64 collect2: error: ld returned 1 exit status

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented May 7, 2023

currently the option passes -export-dynamic to the linker. will try.

https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Link-Options.html#index-rdynamic

@kenz-gelsoft
Copy link
Owner Author

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented May 8, 2023

This change fixed this!

diff --git a/build/gecko_templates.mozbuild b/build/gecko_templates.mozbuild
index 51aae5b870..b27bc35967 100644
--- a/build/gecko_templates.mozbuild
+++ b/build/gecko_templates.mozbuild
@@ -41,7 +41,9 @@ def GeckoBinary(linkage='dependent', mozglue=None):
             USE_LIBS += ['mozglue']
             DEFINES['MOZ_HAS_MOZGLUE'] = True
             if CONFIG['MOZ_GLUE_IN_PROGRAM'] and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
-                LDFLAGS += ['-rdynamic']
+                #LDFLAGS += ['-rdynamic']
+                LDFLAGS += ['-Wl,-export-dynamic']
+                pass
         elif mozglue == 'library':
             LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
             if not CONFIG['MOZ_GLUE_IN_PROGRAM']:

next failure...

~/src/firefox-102.9.0> ./mach run
 0:02.05 /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/firefox -no-remote -profile /boot/home/src/firefox-102.9.0/obj-ff-dbg/tmp/profile-default
TS_tfopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/dependentlibs.list
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/liblgpllibs.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozsqlite3.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozgtk.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libmozwayland.so
dlopen: path: /boot/home/src/firefox-102.9.0/obj-ff-dbg/dist/bin/libxul.so

(firefox-default:67528): Gtk-WARNING **: 22:40:28.261: Locale not supported by C library.
        Using the fallback 'C' locale.
Error: no DISPLAY environment variable specified
[67528, Unnamed thread 105944250c40] WARNING: XPCOM object nsStringBuffer released from static ctor/dtor: file /boot/home/src/firefox-102.9.0/xpcom/base/nsTraceRefcnt.cpp:206
nsStringStats
 => mAllocCount:              9
 => mReallocCount:            0
 => mFreeCount:               8  --  LEAKED 1 !!!
 => mShareCount:              2
 => mAdoptCount:              0
 => mAdoptFreeCount:          0
 => Process ID: 67528, Thread ID: 293696546944
~/src/firefox-102.9.0> 

@kenz-gelsoft
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant