For the adventurous: News from the LDC/Linux front

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 8 16:23:38 PDT 2014


On Tuesday, 8 July 2014 at 22:44:30 UTC, David Nadlinger wrote:
> On Tuesday, 8 July 2014 at 20:43:19 UTC, Joseph Rushton 
> Wakeling wrote:
>> Tried building hap.random's benchmarknew with the 
>> shared-library build of ldc, and got this error when I tried 
>> to run the resulting executable:
>>
>> Fatal Error while loading '/opt/ldc/lib/libphobos2-ldc.so.65':
>> 	The module 'std.range' is already defined in './benchmarknew'.
> […]

In an unexpected turn of events, it seems like you can also avoid 
this problem with ld.bfd by simply building with 
"-disable-linker-strip-dead".

This isn't supposed to happen. Under any circumstances. At all.

Running the program in a debugger, it seems like the 
__bss_start/_end symbols are off, just as I encountered 
previously. In fact, they apparently point to an address range 
that isn't mapped into the process at all!

I couldn't track down why this is happening yet. Here is 
something odd I noticed about the bfd-linked binary, though:
---
$ readelf --dyn-syms benchmarknew.bfd

Symbol table '.dynsym' contains 407 entries:
    Num:    Value          Size Type    Bind   Vis      Ndx Name
      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
      1: 000000000065c518     0 NOTYPE  LOCAL  DEFAULT   29 _edata
      2: 000000000065d228     0 NOTYPE  LOCAL  DEFAULT   30 _end
      3: 000000000065c518     0 NOTYPE  LOCAL  DEFAULT   30 
__bss_start
[…]
---
The __bss_start/_end symbols have somehow turned LOCAL, whereas 
they should be globally visible to override the ones defined in 
libdruntime.so. I suspect that this is involved in the 
nonsensical values of 0x50b4d8/0x50b728 I get inside druntime. 
Note also that the offset between these two addresses is also not 
remotely correct.

David


More information about the Digitalmars-d mailing list