Topic
  • 4 replies
  • Latest Post - ‏2012-04-30T10:42:31Z by graza
graza
graza
3 Posts

Pinned topic loadquery() usage question and causing SEGV when compiled in 64-bit mode

‏2012-04-04T11:07:07Z |
Hi,

I'm trying to compile Ruby 1.9.3-p125 on AIX using xlc_r. I want to use the --enable-load-relative but that's dependent on the dladdr() function to get the pathname of a shared library. I found an implementation of dladdr() for AIX based on a call to loadquery(L_GETINFO). But I'm having two issues:

The worst of these two issues is that loadquery(L_GETINFO) causes a segmentation violation when called from a 64-bit program. I can't live without 64-bit so this is a showstopper for me.

The other issue is that i'm not sure I really understand how the ld_info structure contents can be used. I'm trying to check to see if the address of a function is between ldinfo_textorg and ldinfo_textorg+ldinfo_textsize. But the address of the function I'm checking isn't within this address range for any of the structures returned.

I've attached the code I'm testing. Any help that can be rendered to these questions will be much appreciated.

Many Thanks & Regards,
Graham.

Attachments

Updated on 2012-04-30T10:42:31Z at 2012-04-30T10:42:31Z by graza
  • graza
    graza
    3 Posts

    Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode

    ‏2012-04-11T14:14:49Z  
    I've also asked this question on stackoverflow.com and gotten a response regarding the usage. It seems that the function pointer has to be dereferenced because of something called "pointer glue" on AIX. I'm still searching for an answer to the SEGV problem.
  • flodstrom
    flodstrom
    58 Posts

    Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode

    ‏2012-04-26T15:55:49Z  
    I remember using the same CERN code in the past and I had success using it to get that dladdr "simulation" to work. Although I did not do it in 64bit.

    Is it specific to RUBY you get the segmentation fault or do you also get it with that sample code attached?
  • flodstrom
    flodstrom
    58 Posts

    Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode

    ‏2012-04-27T10:58:59Z  
    • flodstrom
    • ‏2012-04-26T15:55:49Z
    I remember using the same CERN code in the past and I had success using it to get that dladdr "simulation" to work. Although I did not do it in 64bit.

    Is it specific to RUBY you get the segmentation fault or do you also get it with that sample code attached?
    Forgot to mention that I did not have any problems running your attached test case when compiled for 64bit.
  • graza
    graza
    3 Posts

    Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode

    ‏2012-04-30T10:42:31Z  
    It looks like this is a problem with the system I'm using. The sample code only fails there; I tested on another AIX system we have the code compiled and ran fine. For reference, the stackoverflow.com question can be found here:

    http://stackoverflow.com/questions/10020070/aix-loadquery-segv-in-64-bit-mode-and-return-value-interpretation/

    I'm going to revise the question to remove the SEGV stuff because that's my own system's problem, not part of the usage issue.