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]

Re: PATCH: Darwin / Mac OS X native support, revised


Geoff Keating wrote:
> 
> OK, except for the bit that Richard has already pointed out:
> darwin_output_function_profiler will certainly not work in its
> current form, you have to add the profiling code earlier and let
> reload worry about register allocation.

I got it working this time, and in fact it produces much better
code than what our hacked 2.95 does!  Here's the only interesting part
of the revised revised patch:

*************** output_profile_hook (labelno)
*** 7226,7231 ****
--- 7311,7338 ----
        emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1,
                           fun, Pmode);
      }
+   else if (DEFAULT_ABI == ABI_DARWIN)
+     {
+       char *mcount_name = RS6000_MCOUNT;
+       int caller_addr_regno = LINK_REGISTER_REGNUM;
+ 
+       /* Be conservative and always set this, at least for now.  */
+       current_function_uses_pic_offset_table = 1;
+ 
+ #if TARGET_MACHO
+       /* For PIC code, set up a stub and collect the caller's address
+        from r0, which is where the prologue puts it.  */
+       if (flag_pic)
+       {
+         mcount_name = machopic_stub_name (mcount_name);
+         if (current_function_uses_pic_offset_table)
+           caller_addr_regno = 0;
+       }
+ #endif
+       emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mcount_name),
+                        0, VOIDmode, 1,
+                        gen_rtx_REG (Pmode, caller_addr_regno), Pmode);
+     }
  }

> I'd also appreciate it if you could also check that one non-darwin
> powerpc port (your choice) still builds, just to catch simple errors.

powerpc-eabi seems to work fine.

So I'll run one more bootstrap, and commit everything later today if
there are no further issues.  Thanks for all the help!

Stan


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