Revision: 157 http://trac.macosforge.org/projects/odcctools/changeset/157 Author: peter@pogma.com Date: 2009-07-03 09:15:53 -0700 (Fri, 03 Jul 2009) Log Message: ----------- Enable LTO support. This is pretty awesome, can use clang-cc -triple i386-apple-darwin9.5.0 -emit-llvm-bc on linux, then use our ld64 to create an i386-apple-darwin executable. This is, of course, using a standard install of clang and llvm on linux. * files/configure.ac: Check for libLTO. * files/ld64/Makefile.in: Use libLTO. * extract.sh: Add new patch. * patches/ld64/LTOReader-setasmpath.diff: Explicitly tell libLTO the path to as. Modified Paths: -------------- trunk/ChangeLog.odcctools trunk/extract.sh trunk/files/configure.ac trunk/files/ld64/Makefile.in Added Paths: ----------- trunk/patches/ld64/LTOReader-setasmpath.diff Modified: trunk/ChangeLog.odcctools =================================================================== --- trunk/ChangeLog.odcctools 2009-07-02 17:14:53 UTC (rev 156) +++ trunk/ChangeLog.odcctools 2009-07-03 16:15:53 UTC (rev 157) @@ -1,3 +1,16 @@ +2009-07-03 Peter O'Gorman <peter@pogma.com> + + Enable LTO support. This is pretty awesome, can use clang-cc -triple + i386-apple-darwin9.5.0 -emit-llvm-bc on linux, then use our ld64 to + create an i386-apple-darwin executable. This is, of course, using a + standard install of clang and llvm on linux. + + * files/configure.ac: Check for libLTO. + * files/ld64/Makefile.in: Use libLTO. + * extract.sh: Add new patch. + * patches/ld64/LTOReader-setasmpath.diff: Explicitly tell libLTO the + path to as. + 2009-07-02 Peter O'Gorman <peter@pogma.com> Um, yeah, so ld64-85.2.2 is older than ld64-85.2.1, so, putting back Modified: trunk/extract.sh =================================================================== --- trunk/extract.sh 2009-07-02 17:14:53 UTC (rev 156) +++ trunk/extract.sh 2009-07-03 16:15:53 UTC (rev 157) @@ -72,7 +72,8 @@ misc/libtool-ldpath.diff misc/libtool-pb.diff misc/ranlibname.diff \ misc/redo_prebinding.nogetattrlist.diff \ misc/redo_prebinding.nomalloc.diff misc/libtool_lipo_transform.diff \ -otool/nolibmstub.diff otool/noobjc.diff force_load.diff" +otool/nolibmstub.diff otool/noobjc.diff force_load.diff \ +ld64/LTOReader-setasmpath.diff" ADDEDFILESDIR=${TOPSRCDIR}/files Modified: trunk/files/configure.ac =================================================================== --- trunk/files/configure.ac 2009-07-02 17:14:53 UTC (rev 156) +++ trunk/files/configure.ac 2009-07-03 16:15:53 UTC (rev 157) @@ -326,6 +326,14 @@ [No uuid_generate_random function found])])]) AC_SUBST([UUID_LIBS]) +# LTO +AC_CHECK_LIB([LTO],[lto_get_version],[ + LTO_LIBS=-lLTO + LTO_DEFS="-DLTO_SUPPORT=1" + ]) +AC_SUBST(LTO_LIBS) +AC_SUBST(LTO_DEFS) + AC_CONFIG_FILES([Makefile include/Makefile libstuff/Makefile libmacho/Makefile]) AC_CONFIG_FILES([ar/Makefile]) AC_CONFIG_FILES([as/Makefile]) Modified: trunk/files/ld64/Makefile.in =================================================================== --- trunk/files/ld64/Makefile.in 2009-07-02 17:14:53 UTC (rev 156) +++ trunk/files/ld64/Makefile.in 2009-07-03 16:15:53 UTC (rev 157) @@ -22,6 +22,8 @@ HAVE_FOREIGN_HEADERS = @HAVE_FOREIGN_HEADERS@ UUID_LIBS = @UUID_LIBS@ SSL_LIBS = @SSL_LIBS@ +LTO_DEFS = @LTO_DEFS@ +LTO_LIBS = @LTO_LIBS@ ifeq ($(HAVE_PRIVEXT),NO) INCPRIVEXT = -include $(top_srcdir)/include/extern.h @@ -34,16 +36,18 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ transform = @program_transform_name@ -LDPROG = $(shell echo ld_classic | sed '$(transform)') +LDPROG = $(shell echo ld_classic | sed '$(transform)') +ASPROG = $(shell echo as | sed '$(transform)') - MYINCLUDES = -I$(builddir) -I$(srcdir) -I$(srcdir) -I$(srcdir)/Readers \ -I$(srcdir)/Writers -I$(top_builddir)/include \ -I$(top_srcdir)/include $(INCPRIVEXT) $(FORHDRS) MYWARNINGS = -MYDEFS = -DDEBUG -DBINDIR="\"$(bindir)\"" -DLDPROG="\"$(LDPROG)\"" +MYDEFS = -DDEBUG -DBINDIR="\"$(bindir)\"" -DLDPROG="\"$(LDPROG)\"" \ + -DASPROG="\"$(ASPROG)\"" $(LTO_DEFS) + MYLDFLAGS = -L$(top_builddir)/libstuff -MYLIBS = -lstuff $(SSL_LIBS) $(UUID_LIBS) +MYLIBS = -lstuff $(SSL_LIBS) $(UUID_LIBS) $(LTO_LIBS) MYCOMPILEFLAGS = $(WARNINGS) $(MYWARNINGS) $(DEFS) $(MYDEFS) \ $(CPPFLAGS) $(MYINCLUDES) $(CFLAGS) $(MDYNAMICNOPIC) Added: trunk/patches/ld64/LTOReader-setasmpath.diff =================================================================== --- trunk/patches/ld64/LTOReader-setasmpath.diff (rev 0) +++ trunk/patches/ld64/LTOReader-setasmpath.diff 2009-07-03 16:15:53 UTC (rev 157) @@ -0,0 +1,11 @@ +--- src/LTOReader.hpp.orig 2008-07-10 20:15:14.000000000 -0500 ++++ src/LTOReader.hpp 2009-07-03 10:58:35.000000000 -0500 +@@ -431,6 +431,8 @@ + + // create optimizer and add each Reader + lto_code_gen_t generator = ::lto_codegen_create(); ++ ++ ::lto_codegen_set_assembler_path(generator, BINDIR "/" ASPROG ); + for (std::set<Reader*>::iterator it=fgReaders.begin(); it != fgReaders.end(); ++it) { + if ( ::lto_codegen_add_module(generator, (*it)->fModule) ) + throwf("lto: could not merge in %s because %s", (*it)->fPath, ::lto_get_error_message());
participants (1)
-
source_changes@macosforge.org