Skip to content

Commit

Permalink
Merge pull request #1186 from dancrossnyc/upstream
Browse files Browse the repository at this point in the history
illumos: Treat absolute symbols specially
  • Loading branch information
rui314 authored Feb 1, 2024
2 parents 206fe85 + bed5b17 commit 91a88ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion elf/passes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,20 @@ void parse_symbol_version(Context<E> &ctx) {
});
}

namespace {
template <typename E>
inline bool should_import_absolute_sym(const Symbol<E> *sym) {
#ifdef __sun
// On illumos, symbols with shndx=SHN_ABS and st_value=0 are special
// and should be imported.
return sym->value == 0;
#else
(void)sym;
return false;
#endif
}
} // anonymous namespace

template <typename E>
void compute_import_export(Context<E> &ctx) {
Timer t(ctx, "compute_import_export");
Expand Down Expand Up @@ -1823,7 +1837,7 @@ void compute_import_export(Context<E> &ctx) {
for (Symbol<E> *sym : file->get_global_syms()) {
// If we are using a symbol in a DSO, we need to import it.
if (sym->file && sym->file->is_dso) {
if (!sym->is_absolute()) {
if (!sym->is_absolute() || should_import_absolute_sym(sym)) {
std::scoped_lock lock(sym->mu);
sym->is_imported = true;
}
Expand Down
2 changes: 1 addition & 1 deletion third-party/mimalloc/src/prim/unix/prim.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void* unix_mmap(void* addr, size_t size, size_t try_alignment, int protec
#elif defined(__sun)
if (allow_large && _mi_os_use_large_page(size, try_alignment)) {
struct memcntl_mha cmd = {0};
cmd.mha_pagesize = large_os_page_size;
cmd.mha_pagesize = _mi_os_large_page_size();
cmd.mha_cmd = MHA_MAPSIZE_VA;
if (memcntl((caddr_t)p, size, MC_HAT_ADVISE, (caddr_t)&cmd, 0, 0) == 0) {
*is_large = true;
Expand Down

0 comments on commit 91a88ee

Please sign in to comment.