Shared library problem (dlopen, dlsym)
#1
Shared library problem (dlopen, dlsym)
Hello,

I am testing shared libraries (.so). I made a sample library and sample test program, using dlopen, dlsym, and so on.
Shared libraries are memory mapped starting at 0xEF000000.

As far as I found debugging my code, it appears the sample library is correctly loaded @ 0xEFxxxxxxxx.
Using dlsym on functions works ok.

But, it looks like pointers stored in structures are not relocated correctly. In fact, all is missing is the 0xEFxxxxxx upper bits.

For example, If I use dlsym to get a structure with pointers (strings, functions, whatever), the
structure pointers are missing 0xEF in the upper bits.

Example : 0x006d0828 instead of 0xfe006d0828.

I am using gcc version 2.95.2.

The shared library is loaded using RTLD_NOW | RTLD_GLOBAL flags.

Any idea where I could be wrong ? I suspect gcc, but, being not an expert on solaris programming, 
I prefer asking first.

thank you for your help !

Looks like I am not the first one... 


Quote:Shared library problems on Solaris



From:
david . henderson
Subject:
Shared library problems on Solaris
Date:
Tue, 20 Mar 2001 12:01:36 +0000




I've just updated my compiler to GCC 2.95.3 on Solaris 2.5.1 ( sparc) and i'm
having problems with some C++ shared libraries.
I'm finding that any data initialized in the shared library is not correct (
it's null) when application programs come to us it. I'd rather not use static
versions of these libraries if it can be helped.

These shared libraries work ok when compiled with V4 of the Sun C++ compiler or
GCC 2.91.x on a Linux system.

Am i missing some compiler/linker options or is there a fault in this version of
the compiler. ( All 2.95.x version of GCC have given the same problem).

CONFIDENTIALITY : This  e-mail  and  any attachments are confidential and may be
privileged. If  you are not a named recipient, please notify the sender
immediately and do not disclose the contents to another person, use it for any
purpose or store or copy the information in any medium.

Sharp X68000 PRO HD 4MB Bluescsi
HP Kayak XA-s, Dual Pentium II 400 Mhz 512 MB Voodoo 3, 2x2TB
Sun SparcStation 5 @ 170 Mhz (TurboSparc), 96MB Ram, TGX+ graphics, 2x18GB SCSI
BeBox Dual PPC 603e @ 133 Mhz, 128 MB Ram 2GB SCSI
SGI Octane R14000 @ 600 Mhz 1GB VPro 12 128MB 8GB SCSI
NeXTCube 68040 @ 25 Mhz 64MB NeXTDimension Board 64MB 2GB SCSI
NeXTStation Color 68040 @ 25 Mhz 64 MB  2GB SCSI
NeXTStation Turbo Mono 68040 @ 33 Mhz 64MB  16GB SCSI
NeXTStation Turbo Color 68040 @ 33 Mhz 128MB 4GB SCSI
AlienWare Aurora R8 I9-9900K @ 5 Ghz 64GB 2 x GeForce RTX 2080TI 11GB SLI 1TB SSD NVMe M2 2TB HD

10Gb optical fiber Internet
(This post was last modified: 06-11-2021, 12:16 PM by octaneirix6530.)
octaneirix6530
Octane

Trade Count: (0)
Posts: 129
Threads: 41
Joined: Nov 2019
Location: France
Find Reply
06-11-2021, 11:31 AM
#2
RE: Shared library problem (dlopen, dlsym)
works with WS sparc C compiler but not gcc  Angry

Sharp X68000 PRO HD 4MB Bluescsi
HP Kayak XA-s, Dual Pentium II 400 Mhz 512 MB Voodoo 3, 2x2TB
Sun SparcStation 5 @ 170 Mhz (TurboSparc), 96MB Ram, TGX+ graphics, 2x18GB SCSI
BeBox Dual PPC 603e @ 133 Mhz, 128 MB Ram 2GB SCSI
SGI Octane R14000 @ 600 Mhz 1GB VPro 12 128MB 8GB SCSI
NeXTCube 68040 @ 25 Mhz 64MB NeXTDimension Board 64MB 2GB SCSI
NeXTStation Color 68040 @ 25 Mhz 64 MB  2GB SCSI
NeXTStation Turbo Mono 68040 @ 33 Mhz 64MB  16GB SCSI
NeXTStation Turbo Color 68040 @ 33 Mhz 128MB 4GB SCSI
AlienWare Aurora R8 I9-9900K @ 5 Ghz 64GB 2 x GeForce RTX 2080TI 11GB SLI 1TB SSD NVMe M2 2TB HD

10Gb optical fiber Internet
octaneirix6530
Octane

Trade Count: (0)
Posts: 129
Threads: 41
Joined: Nov 2019
Location: France
Find Reply
06-11-2021, 04:36 PM
#3
RE: Shared library problem (dlopen, dlsym)
Welcome to the great and wonderful world of open source software development, where software lacks the concept of quality (putting hours into it until reaching a fully implemented *and* fully tested feature set).

Just stick to the vendors compiler or wait until a kind soul implements what you need (only to run into any other issue and pull your hair).

Regards
TruHobbyist
Developer

Trade Count: (0)
Posts: 195
Threads: 21
Joined: May 2018
Find Reply
06-12-2021, 05:55 AM
#4
RE: Shared library problem (dlopen, dlsym)
Joy

Sharp X68000 PRO HD 4MB Bluescsi
HP Kayak XA-s, Dual Pentium II 400 Mhz 512 MB Voodoo 3, 2x2TB
Sun SparcStation 5 @ 170 Mhz (TurboSparc), 96MB Ram, TGX+ graphics, 2x18GB SCSI
BeBox Dual PPC 603e @ 133 Mhz, 128 MB Ram 2GB SCSI
SGI Octane R14000 @ 600 Mhz 1GB VPro 12 128MB 8GB SCSI
NeXTCube 68040 @ 25 Mhz 64MB NeXTDimension Board 64MB 2GB SCSI
NeXTStation Color 68040 @ 25 Mhz 64 MB  2GB SCSI
NeXTStation Turbo Mono 68040 @ 33 Mhz 64MB  16GB SCSI
NeXTStation Turbo Color 68040 @ 33 Mhz 128MB 4GB SCSI
AlienWare Aurora R8 I9-9900K @ 5 Ghz 64GB 2 x GeForce RTX 2080TI 11GB SLI 1TB SSD NVMe M2 2TB HD

10Gb optical fiber Internet
octaneirix6530
Octane

Trade Count: (0)
Posts: 129
Threads: 41
Joined: Nov 2019
Location: France
Find Reply
06-12-2021, 09:40 AM


Forum Jump:


Users browsing this thread: 2 Guest(s)