[patch] LTO support for Mach-O (apple-darwin)
Steven Bosscher
stevenb.gcc@gmail.com
Sat May 8 12:42:00 GMT 2010
On Wed, May 5, 2010 at 5:34 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
> I tried a modified version of the patch to build on powerpc-apple-darwin9
> but no joy from the lto testsuite. The failures are of the form...
>
> Executing on host: /Users/howarth/darwin_objdir/gcc/xgcc -B/Users/howarth/darwin_objdir/gcc/ -O0 -fwhopr -c -o c_lto_20
> 080908_0.o /Users/howarth/gcc/gcc/testsuite/gcc.dg/lto/20080908_0.c (timeout = 300)
> /var/tmp//ccZXeZ2X.s:35:unknown section attribute: debug#.gnu.lto_foo
> /var/tmp//ccZXeZ2X.s:35:Rest of line ignored. 1st junk character valued 32 ( ).
> /var/tmp//ccZXeZ2X.s:35:Junk character 92 (\).
> /var/tmp//ccZXeZ2X.s:35:Rest of line ignored. 1st junk character valued 50 (2).
> /var/tmp//ccZXeZ2X.s:51:unknown section attribute: debug#.gnu.lto_.cgraph
> /var/tmp//ccZXeZ2X.s:51:Rest of line ignored. 1st junk character valued 32 ( ).
Bah, stupid apple assembler. Same syntax, different parsers for x86
and powerpc, it seems. The powerpc assembler doesn't like comment at
the end of a .section line.
Try with this patch, please.
Ciao!
Steven
Index: configure.ac
===================================================================
--- configure.ac (revision 159173)
+++ configure.ac (working copy)
@@ -1803,7 +1803,7 @@ fi],[if test x"$default_enable_lto" = x"
# -flto it won't be needed until after installation anyway.
case $target in
*-cygwin*|*-mingw*) ;;
- x86_64-apple-darwin*) ;;
+ *-apple-darwin*) ;;
*) if test x"$enable_lto" = x"yes"; then
AC_MSG_ERROR([LTO support is not enabled for this target.])
fi
Index: configure
===================================================================
--- configure (revision 159173)
+++ configure (working copy)
@@ -6686,7 +6686,7 @@ else
# -flto it won't be needed until after installation anyway.
case $target in
*-cygwin*|*-mingw*) ;;
- x86_64-apple-darwin*) ;;
+ *-apple-darwin*) ;;
*) if test x"$enable_lto" = x"yes"; then
as_fn_error "LTO support is not enabled for this target." "$LINENO" 5
fi
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc (revision 159173)
+++ gcc/config.gcc (working copy)
@@ -1888,12 +1888,14 @@ powerpc-*-darwin*)
*-darwin[0-6]*)
;;
esac
+ lto_binary_reader=lto-macho
extra_headers=altivec.h
;;
powerpc64-*-darwin*)
tm_file="${tm_file} ${cpu_type}/darwin8.h ${cpu_type}/darwin64.h"
extra_options="${extra_options} ${cpu_type}/darwin.opt"
# We're omitting t-darwin8 to avoid building any multilibs
+ lto_binary_reader=lto-macho
extra_headers=altivec.h
;;
powerpc*-*-freebsd*)
Index: gcc/config/darwin.c
===================================================================
--- gcc/config/darwin.c (revision 159173)
+++ gcc/config/darwin.c (working copy)
@@ -1460,8 +1460,9 @@ darwin_asm_named_section (const char *na
obstack_grow (<o_section_names_obstack, "\\0\"\n", 4);
/* Output the dummy section name. */
- fprintf (asm_out_file, "\t.section %s,__%08X,regular,debug\t# %s\n",
- LTO_SEGMENT_NAME, lto_section_names_offset, name);
+ fprintf (asm_out_file, "\t# %s\n", name);
+ fprintf (asm_out_file, "\t.section %s,__%08X,regular,debug\n",
+ LTO_SEGMENT_NAME, lto_section_names_offset);
/* Update the offset for the next section name. Make sure we stay
within reasonable length. */
More information about the Gcc-patches
mailing list