Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1948 closed enhancement (fixed)

Make dl*() Functions Standard Compliant

Reported by: bonefish Owned by: axeld
Priority: normal Milestone: R1
Component: System/libroot.so Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

Our dl*() have several issues ATM:

  • Multiple calls to dlopen() should open the object only once.
  • Passing NULL to dlopen() should open the executable.
  • The flags passed to dlopen() are ignored. That is OK for RTLD_LAZY/RTLD_NOW (we always relocate everything when loading), but probably not for RTLD_GLOBAL/RTLD_LOCAL.
  • dlsym() searches only the object itself, not dependencies.
  • Other issues I have missed.

Change History (9)

comment:1 by jackburton, 11 years ago

Maybe we should use glibc's dl* functions instead of rolling our own ?

in reply to:  1 comment:2 by bonefish, 11 years ago

Replying to jackburton:

Maybe we should use glibc's dl* functions instead of rolling our own ?

I don't think glibc provides those functions. Given that they need to interface with the platform-specific runtime loader there would be little they could do anyway.

comment:3 by korli, 11 years ago

Is this ticket covered by dl* changes ?

comment:4 by bonefish, 11 years ago

Resolution: fixed
Status: newclosed

comment:5 by scottmc, 11 years ago

Resolution: fixed
Status: closedreopened

It seem both the cmake and python ports (others?) are having issues with the dl*() functions still not being quite standards compliant.

comment:6 by scottmc, 11 years ago

Scratch python from that last statement, I checked the regression test "test_dl" and it was looking for getpid(), adding ('libroot.so', 'getpid'), to the test seems to fix it.

comment:7 by bonefish, 11 years ago

Unlike I assumed before, the POSIX standard requirement that for the relocation of dlopen()ed objects the executable symbols are available as well, is indeed respected by Linux. The runtime loader test suite src/tests/system/runtime_loader/test_suite just doesn't provide the --export-dynamic linker flag when building the exectuables.

comment:8 by bonefish, 11 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in hrev29112. BTW, please don't reopen enhancement tickets for bug report.

comment:9 by scottmc, 11 years ago

thanks. that did the trick.

Note: See TracTickets for help on using tickets.