[PATCH] Only modify lto.exports.def when contents have changed

Rafael EspĂ­ndola rafael.espindola at gmail.com
Thu Oct 31 14:12:05 PDT 2013


Looks like this caused http://llvm.org/bugs/show_bug.cgi?id=17763. Can
you take look?

On 4 October 2013 02:51, Greg Bedwell <greg_bedwell at sn.scee.net> wrote:
> gbedwell added you to the CC list for the revision "Only modify lto.exports.def when contents have changed".
>
> Previously, for Win32 builds we were regenerating the lto.exports.def file every time that CMake was run regardless or not of whether the file contents had changed.  This was forcing LTO.dll to be rebuilt each time that CMake was run even if there were no other differences.  This patch writes an intermediate file which is compared to the actual file (if it already exists).  If there is any difference, the intermediate file is copied in place of the actual file, otherwise the actual file is left unmodified.  This is the same technique used in GetSVN.cmake for the generated version header file.
>
> If this looks okay, please could you commit for me?
>
> Thanks,
>
> Greg Bedwell
> SN Systems - Sony Computer Entertainment Group
>
> http://llvm-reviews.chandlerc.com/D1832
>
> Files:
>   tools/lto/CMakeLists.txt
>
> Index: tools/lto/CMakeLists.txt
> ===================================================================
> --- tools/lto/CMakeLists.txt
> +++ tools/lto/CMakeLists.txt
> @@ -15,10 +15,16 @@
>      # 'EXPORTS'.  The file "lto.exports" already contains the list, so we
>      # massage it into the correct format here to create "lto.exports.def".
>      set(LTO_EXPORTS_DEF ${CMAKE_CURRENT_BINARY_DIR}/lto.exports.def)
> +    set(LTO_EXPORTS_DEF_TEMP ${LTO_EXPORTS_DEF}.txt)
>      file(READ "lto.exports" exports_list)
> -    file(WRITE ${LTO_EXPORTS_DEF} "LIBRARY LTO\n")
> -    file(APPEND ${LTO_EXPORTS_DEF} "EXPORTS\n")
> -    file(APPEND ${LTO_EXPORTS_DEF} ${exports_list})
> +    file(WRITE ${LTO_EXPORTS_DEF_TEMP} "LIBRARY LTO\n")
> +    file(APPEND ${LTO_EXPORTS_DEF_TEMP} "EXPORTS\n")
> +    file(APPEND ${LTO_EXPORTS_DEF_TEMP} ${exports_list})
> +
> +    # Copy the file only if it has changed.
> +    execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
> +      ${LTO_EXPORTS_DEF_TEMP} ${LTO_EXPORTS_DEF})
> +
>      set(SHARED_LIB_SOURCES ${SOURCES} ${LTO_EXPORTS_DEF})
>    else()
>      set(SHARED_LIB_SOURCES ${SOURCES})
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list