Changes between Initial Version and Version 1 of Ticket #54242, comment 3


Ignore:
Timestamp:
Jul 20, 2017, 7:31:45 AM (7 years ago)
Author:
kencu (Ken)
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54242, comment 3

    initial v1  
    44work/llvm-3.8.1.src/projects/compiler-rt/cmake/config-ix.cmake
    55}}}
    6 and checks for the 10.4 RT arches like this:
    7 {{{
    8 
    9   # Figure out which arches to use for each OS
    10   darwin_get_toolchain_supported_archs(toolchain_arches)
    11   message(STATUS "Toolchain supported arches: ${toolchain_arches}")
    12 
    13 
    14  # Need to build a 10.4 compatible libclang_rt
    15     set(DARWIN_10.4_SYSROOT ${DARWIN_osx_SYSROOT})
    16     set(DARWIN_10.4_BUILTIN_MIN_VER 10.4)
    17     set(DARWIN_10.4_BUILTIN_MIN_VER_FLAG
    18         -mmacosx-version-min=${DARWIN_10.4_BUILTIN_MIN_VER})
    19     set(DARWIN_10.4_SKIP_CC_KEXT On)
    20     darwin_test_archs(10.4
    21       DARWIN_10.4_ARCHS
    22       ${toolchain_arches})
    23     message(STATUS "OSX 10.4 supported arches: ${DARWIN_10.4_ARCHS}")
    24     if(DARWIN_10.4_ARCHS)
    25       # don't include the Haswell slice in the 10.4 compatibility library
    26       list(REMOVE_ITEM DARWIN_10.4_ARCHS x86_64h)
    27       list(APPEND BUILTIN_SUPPORTED_OS 10.4)
    28     endif()
    29 }}}
    30 
    31 which calls darwin_get_toolchain_supported_archs which is in this file
    32 
    33 {{{
    34 work/llvm-3.8.1.src/projects/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
    35 }}}
    36 
    37 {{{
    38 function(darwin_get_toolchain_supported_archs output_var)
    39   execute_process(
    40     COMMAND ld -v
    41     ERROR_VARIABLE LINKER_VERSION)
    42 
    43   string(REGEX MATCH "configured to support archs: ([^\n]+)"
    44          ARCHES_MATCHED "${LINKER_VERSION}")
    45   if(ARCHES_MATCHED)
    46     set(ARCHES "${CMAKE_MATCH_1}")
    47     message(STATUS "Got ld supported ARCHES: ${ARCHES}")
    48     string(REPLACE " " ";" ARCHES ${ARCHES})
    49   else()
    50     # If auto-detecting fails, fall back to a default set
    51     message(WARNING "Detecting supported architectures from 'ld -v' failed. Returning default set.")
    52     set(ARCHES "i386;x86_64;armv7;armv7s;arm64")
    53   endif()
    54  
    55   set(${output_var} ${ARCHES} PARENT_SCOPE)
    56 endfunction()
    57 }}}
    58 
    59 on 10.5 INTEL the `ld` test gives you proper archs:
    60 {{{
    61  ld -v
    62 @(#)PROGRAM:ld  PROJECT:ld64-127.2
    63 configured to support archs: i386 x86_64 ppc ppc64 armv6 armv7
    64 LTO support using: LLVM version 3.3
    65 }}}
    66 
    67 but on on 10.5 PPC you get this:
    68 {{{
    69 $ ld -v
    70 @(#)PROGRAM:ld  PROJECT:ld64-127.2
    71 LLVM version 3.3
    72 }}}
    73 
    74 so it goes to the defaults instead
    75 {{{
    76 
    77     set(ARCHES "i386;x86_64;armv7;armv7s;arm64")
    78 }}}
    79 which are wrong for ppc. I generated a simple patch to allowed that test to return:
    80 {{{
    81     set(ARCHES "i386;x86_64;ppc;ppc64;armv7;armv7s;arm64")
    82 }}}
    83 and I had hoped that might solve this error, but as you can see from the configuration listing above, even though it now returns the proper ARCHES from the `ld` test, the error still occurs, so the incorrect arch setting must be elsewhere.
     6It's quite a complex process for building a multi-arch runtime, and would not be trivial to fix. Far easier would be to just rewrite a new cmake script and use it for ppc to build the library.