• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
A mach-o question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A mach-o question


  • Subject: A mach-o question
  • From: Simon Stapleton <email@hidden>
  • Date: Fri, 25 Oct 2002 12:12:47 +0200

Hey all

I've been struggling with this for a day or so, getting nearly nowhere, ploughing through all the docs I can find, etc, so I guess it's time to ask.

I'm trying to do something I shouldn't be doing. I need to get the address of a symbol in a loaded mach-o library that's been declared as __private_extern__. I know I can get it when the library isn't loaded, either by parsing the file myself or by using the (unhelpfully private ;-) bfd.framework. However, the point at which I need to get the address is very early in the loading process, I can't guarantee other libraries are even present, and scanning files is pretty much out of the question. And no, sadly, I can't change the definition of the symbol, as I don't have access to the source for the library in question

So my approach is this:

I get the mach-o header of the library using _dyld_get_image_header and the 'slide' using _dyld_get_image_vm_slide. I then manually scan through the load commands to find the information for LC_SYMTAB, from where I get the offset for the symbol and string tables (element symoff and stroff respectively from the symtab_command structure).

Now, as far as I can see, the start of the symbol table ought to be at header+slide+symoff, and strings at header+slide+stroff. However, this leaves me somewhere strange, as far as I can see - the strings are definitely somewhere in the middle of the string table, and god alone knows where the symbol table is pointing.

My other approach might be to go directly to the LC_LINKEDIT segment, which as far as I can tell should contain these tables, but I have no information on its structure, so all that buys me at the moment is a reference to a block of memory.

Any ideas, or pointers where else to look?

Simon

--
PGP Key Id : 0x50D0698D
--
Eagles may soar, but weasels don't get sucked into jet engines.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Security framework refuses to work at all
  • Next by Date: Re: CarbonWindow in CocoaApp
  • Previous by thread: Re: Subclassing in plugins
  • Next by thread: screensize-dependent interface?
  • Index(es):
    • Date
    • Thread