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,

apologies for
(a) the extra loop - I missed a deprecation warning when I built your last version ...
(b) rolling two things into one mail ...
... (point 1 is related the pie issue, point 2 to linkage hassles).


On 9 Feb 2012, at 08:36, Iain Sandoe wrote:

I think refs (from libstdc++) should be satisfied at link time with -lstdc++ but probably I am missing something?

when you link c++ code, that is what is required .. but obv. we don't want lstdc++ on the link line for c (because the library *will* be found @ runtime - and thus the routines would be called).


I have an idea ... perhaps we supply (yet another) crt that is linked last on the line and provides the dummies. That way the linkage will be satisfied from libstd++ for c++ and the dummies for c.

will try and see if I can fit a trial of that idea in on D9 & D10.

Point 2 below... now I look at this again, I wonder why the current scheme doesn't cause a problem for Rainer on c++ as well?


===

anyway.

1/ one of the routines you had in the fix was deprecated, can we try:

+  Dl_info info;
+
+  if (! dladdr (f, &info) || info.dli_fbase == NULL)
+    abort ();
+
+  mh = (struct mach_header *) info.dli_fbase;

(and the additional header include) instead?

2/ I've moved the dummy routines to the [Darwin] tm crt endfile ..

+/* Provide dummy functions to satisfy linkage for versions of the Darwin tool-chain that
+ that can't handle undefined weak refs at the link stage. */
+
+extern void *__cxa_allocate_exception (size_t) WEAK;
+extern void __cxa_throw (void *, void *, void *) WEAK;
+extern void *__cxa_begin_catch (void *) WEAK;
+extern void *__cxa_end_catch (void) WEAK;
+extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
+
+void *__cxa_allocate_exception (size_t s UNUSED) { return NULL; }
+void __cxa_throw (void * a UNUSED, void * b UNUSED, void * c UNUSED)
+{ return; }
+void *__cxa_begin_catch (void * a UNUSED) { return NULL; }
+void *__cxa_end_catch (void) { return NULL; }
+void __cxa_tm_cleanup (void * a UNUSED, void * b UNUSED, unsigned int c UNUSED)
+{ return; }
+


Rainer, would that work for you too ? ... it would allow removal from libitm/eh_cpp.cc

for now, for Darwin:

-#if !defined (HAVE_ELF_STYLE_WEAKREF)
+#if !defined (HAVE_ELF_STYLE_WEAKREF) && ! defined (__MACH__)

====

The attached works with/without -fpie on Darwin 9, I won't get a chance to test on D10 for a while, that machine is fully tied up ... and I don't have D11 .... could people try it, if this seems reasonable?

Iain

Attachment: 184018-tm-tweaks.txt
Description: Text document



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