Project

General

Profile

Bug #1893

Charm++ binaries cannot find __executable_start when built with -charm-shared

Added by Evan Ramos 5 months ago. Updated 2 months ago.

Status:
Merged
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
05/01/2018
Due date:
% Done:

0%


Description

Currently cmitls uses the symbol __executable_start in order to find the .tbss segment's metadata.

extern void* __executable_start;

static Addr getCodeSegAddr(void) {
  return (Addr) &__executable_start;
}

static Ehdr* getELFHeader(void) {
  return (Ehdr*) getCodeSegAddr();
}

static Phdr* getProgramHeader(void) {
  Ehdr* ehdr = getELFHeader();
  return (Phdr*)((char *)ehdr + ehdr->e_phoff);
}

It has been reported that sometimes __executable_start is not present in the user's executable, preventing launch:

https://lists.cs.illinois.edu/lists/arc/charm/2018-05/msg00001.html

Runtime error:

$ ./<my-executable>
symbol lookup error: <charm-install-dir>/lib_so/libconv-core.so: undefined symbol: __executable_start

ldd output:

$ ldd -r <my_executable>
...
undefined symbol: __executable_start (<charm-install-dir>/lib_so/libconv-core.so)

Compile and link are fine. This is only an error using g++ on linux, v7, 6, and 5, and not with clang or intel compilers.

In this circumstance, the problem affects any Charm++ program.

History

#1 Updated by Evan Ramos 5 months ago

  • Description updated (diff)

#2 Updated by Evan Ramos 5 months ago

  • Description updated (diff)

#3 Updated by Eric Bohm 5 months ago

  • Assignee set to Evan Ramos

#4 Updated by Evan Ramos 5 months ago

  • Description updated (diff)

#5 Updated by Evan Ramos 3 months ago

  • Subject changed from cmitls sometimes cannot find __executable_start to Charm++ binaries cannot find __executable_start when built with -charm-shared

I found a way to reproduce this issue.

$ ./build LIBS netlrts-linux-x86_64-smp -j -g3 --build-shared --suffix=shared
$ cd netlrts-linux-x86_64-smp-shared/tests/ampi/privatization
$ make -j OPTS="-charm-shared" control tlsglobals
$ ./cxx-control
./cxx-control: symbol lookup error: /home/evan/charm/netlrts-linux-x86_64-smp-shared/lib_so/libconv-core.so: undefined symbol: __executable_start

#6 Updated by Evan Ramos 3 months ago

Some initial research on the problem of seeing symbols in the main binary from shared objects suggests adding -rdynamic or -Wl,--export-dynamic to the toolchain invocation, but we already do this. Separately, calling dlsym(RTLD_DEFAULT, "__executable_start") returns NULL.

#7 Updated by Evan Ramos 3 months ago

  • Status changed from New to Implemented

#8 Updated by Sam White 2 months ago

  • Status changed from Implemented to Merged
  • Target version set to 6.9.0

Also available in: Atom PDF