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,
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
4 replies Latest Post - 2012-04-30T10:42:31Z by graza
Pinned topic loadquery() usage question and causing SEGV when compiled in 64-bit mode
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-04-30T10:42:31Z at 2012-04-30T10:42:31Z by graza
Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode2012-04-11T14:14:49Z in response to grazaI'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 0600029Q7U57 PostsACCEPTED ANSWER
Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode2012-04-26T15:55:49Z in response to grazaI 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?
Re: loadquery() usage question and causing SEGV when compiled in 64-bit mode2012-04-30T10:42:31Z in response to grazaIt 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:
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.