This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [trans-mem,darwin] PR/52042 find tm_clone_table with PIE


Hi Patrick,

thanks for looking at this ..

On 8 Feb 2012, at 03:36, Patrick Marlier wrote:

The problem in this PR is that with PIE, getsectdata does not return the position of tm_clone_table after the relocation.
While _dyld_get_image_vmaddr_slide(0) is enough for PIE, this is not enough for dylib.
I did not find an easy API function to get position of the tm_clone_table for a shared library (dylib). So the only way I found is to get the mach_header address of the current dylib (via _dyld_get_image_header_containing_address), iterate over loaded binaries to find the current shared library and use _dyld_get_image_vmaddr_slide to find the position.
Any other proposal (my knowledge of darwin is really limited)?


Can someone do a bootstrap and test libitm on darwin (I have a limited access to a darwin machine, at least libitm tests pass)? Thanks!

If tests passed, ok for 4.7?
--
Patrick Marlier.
libgcc:

	PR libitm/52042
       * config/darwin-crt-tm.c: Changes for PIE and shared library.

<darwin-pie2.patch>

looks good to me .. and DTRT on Darwin 9 too .. (but I can't approve).


one nit (also mea culpa in the original...)

/* not listed in mach-o/dyld.h for some reason. */
-extern char * getsectdata (const char*,const char*,unsigned long*);
+extern char *getsectdatafromheader (struct mach_header*, const char*,
+ const char*, unsigned long*);
+extern char *getsectdatafromheader_64 (struct mach_header_64*, const char*,
+ const char*, unsigned long*);


these are in <mach-o/getsect.h>

(dyld documentation glitch ...)

===

Sometime: I wonder if we should move the definition of the section name to a common place so that we don't need to worry about keeping it in step. Or even better have some compiler-wide mechanism for dealing with the fact that named sections might have different literals/ semantics per target.

Iain


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]