Opened 11 years ago

Closed 10 years ago

Last modified 10 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 Changed 11 years ago by jackburton

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

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

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 Changed 10 years ago by korli

Is this ticket covered by dl* changes ?

comment:4 Changed 10 years ago by bonefish

Resolution: fixed
Status: newclosed

comment:5 Changed 10 years ago by scottmc

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 Changed 10 years ago by scottmc

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 Changed 10 years ago by bonefish

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 Changed 10 years ago by bonefish

Resolution: fixed
Status: reopenedclosed

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

comment:9 Changed 10 years ago by scottmc

thanks. that did the trick.

Note: See TracTickets for help on using tickets.