Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/unstable' into gfx-rdp
Browse files Browse the repository at this point in the history
  • Loading branch information
rasky committed Jan 12, 2024
2 parents 1f15211 + 3ed61bc commit 1921696
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
22 changes: 18 additions & 4 deletions src/dlfcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ static dso_sym_t *mainexe_sym_table;
/** @brief Number of symbols in main executable symbol table */
static uint32_t mainexe_sym_count;

static void insert_module(dl_module_t *module)
/**
* @brief Insert module into module list
*
* This function is non-static to help debuggers support overlays.
*
* @param module Pointer to module
*/
void __attribute__((noinline)) __dl_insert_module(dl_module_t *module)
{
dl_module_t *prev = __dl_list_tail;
//Insert module at end of list
Expand All @@ -92,7 +99,14 @@ static void insert_module(dl_module_t *module)
__dl_num_loaded_modules++; //Mark one more loaded module
}

static void remove_module(dl_module_t *module)
/**
* @brief Remove module from module list
*
* This function is non-static to help debuggers support overlays.
*
* @param module Pointer to module
*/
void __attribute__((noinline)) __dl_remove_module(dl_module_t *module)
{
dl_module_t *next = module->next;
dl_module_t *prev = module->prev;
Expand Down Expand Up @@ -419,7 +433,7 @@ void *dlopen(const char *filename, int mode)
//Add module handle to list
handle->ref_count = 1;
__dl_lookup_module = lookup_module;
insert_module(handle);
__dl_insert_module(handle);
//Start running module
start_module(handle);
}
Expand Down Expand Up @@ -527,7 +541,7 @@ static void close_module(dl_module_t *module)
//Deinitialize module
end_module(module);
//Remove module from memory
remove_module(module);
__dl_remove_module(module);
free(module);
}

Expand Down
10 changes: 6 additions & 4 deletions tools/build-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [[ $OSTYPE == 'darwin'* ]]; then

# Install required dependencies. gsed is really required, the others are optionals
# and just speed up build.
brew install -q gmp mpfr libmpc gsed
brew install -q gmp mpfr libmpc gsed gcc isl libpng lz4 make mpc texinfo zlib

# FIXME: we could avoid download/symlink GMP and friends for a cross-compiler
# but we need to symlink them for the canadian compiler.
Expand All @@ -82,14 +82,17 @@ if [[ $OSTYPE == 'darwin'* ]]; then
"--with-gmp=$(brew --prefix)"
"--with-mpfr=$(brew --prefix)"
"--with-mpc=$(brew --prefix)"
"--with-zlib=$(brew --prefix)"
)

# Install GNU sed as default sed in PATH. GCC compilation fails otherwise,
# because it does not work with BSD sed.
PATH="$(brew --prefix gsed)/libexec/gnubin:$PATH"
export PATH
else
# Configure GCC arguments for non-macOS platforms
GCC_CONFIGURE_ARGS+=("--with-system-zlib")
fi

# Create build path and enter it
mkdir -p "$BUILD_PATH"
cd "$BUILD_PATH"
Expand Down Expand Up @@ -211,8 +214,7 @@ pushd gcc_compile_target
--disable-threads \
--disable-win32-registry \
--disable-nls \
--disable-werror \
--with-system-zlib
--disable-werror
make all-gcc -j "$JOBS"
make install-gcc || sudo make install-gcc || su -c "make install-gcc"
make all-target-libgcc -j "$JOBS"
Expand Down

0 comments on commit 1921696

Please sign in to comment.