Sorted out CMake on x86-64 and fixed silly XMM# bug introduced when working on Win64 stdargs.

I removed the XMM6/7 registers from the register list because they are not used
on Win64 however they are necessary for parameter passing on x86-64. I have now
restored them but not marked them with RC_FLOAT so they will not be used except
for parameter passing.
This commit is contained in:
James Lyon
2013-04-25 22:30:53 +01:00
parent e7a7efed11
commit 1caee8ab3b
10 changed files with 110 additions and 38 deletions

View File

@ -43,6 +43,15 @@ else()
set(DOC_PATH share/doc/tcc)
endif()
if(NOT WIN32)
if(EXISTS /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu/crti.o)
set(CONFIG_LDDIR lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
set(CONFIG_MULTIARCHDIR ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
elseif(EXISTS /usr/lib64/crti.o)
set(CONFIG_LDDIR lib64)
endif()
endif()
# Use two variables to keep CMake configuration variable names consistent
set(TCC_BCHECK OFF CACHE BOOL "Enable bounds checking")
set(CONFIG_TCC_BCHECK ${TCC_BCHECK})
@ -64,6 +73,12 @@ set(TCC_BUILD_C67 OFF CACHE BOOL "Build C67 cross compiler")
set(TCC_ARM_VERSION ${TCC_ARM_VERSION_DEFAULT} CACHE STRING "ARM target CPU version")
set_property(CACHE TCC_ARM_VERSION PROPERTY STRINGS 4 5 6 7)
if(WIN32)
set(CONFIG_TCCDIR ${CMAKE_INSTALL_PREFIX})
else()
set(CONFIG_TCCDIR ${CMAKE_INSTALL_PREFIX}/lib/tcc)
endif()
file(STRINGS "VERSION" TCC_VERSION)
list(GET TCC_VERSION 0 TCC_VERSION)
include_directories(${CMAKE_BINARY_DIR})
@ -123,8 +138,16 @@ endmacro()
macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libtcc_ar libtcc_sources libtcc_includes)
if (xx${native_name} STREQUAL xx${TCC_NATIVE_TARGET})
set(TCC_NATIVE_DEFINITIONS ${definitions})
if("${CONFIG_MULTIARCHDIR}" STRGREATER "")
set(TCC_NATIVE_DEFINITIONS ${TCC_NATIVE_DEFINITIONS} CONFIG_MULTIARCHDIR="${CONFIG_MULTIARCHDIR}")
endif()
if("${CONFIG_LDDIR}" STRGREATER "")
set(TCC_NATIVE_DEFINITIONS ${TCC_NATIVE_DEFINITIONS} CONFIG_LDDIR="${CONFIG_LDDIR}")
endif()
set(TCC_NATIVE_FLAGS)
foreach(make_tcc_def ${definitions})
foreach(make_tcc_def ${TCC_NATIVE_DEFINITIONS})
set(TCC_NATIVE_FLAGS ${TCC_NATIVE_FLAGS} -D${make_tcc_def})
endforeach()
@ -144,16 +167,17 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt
set_target_properties(libtcc PROPERTIES OUTPUT_NAME tcc PREFIX lib LINK_FLAGS "-Wl,--output-def,libtcc.def")
add_executable(tcc tcc.c)
target_link_libraries(tcc libtcc)
install(TARGETS tcc libtcc RUNTIME DESTINATION ${EXE_PATH} LIBRARY DESTINATION ${NATIVE_LIB_PATH})
set_target_properties(tcc libtcc PROPERTIES COMPILE_DEFINITIONS "${definitions}")
if(NOT WIN32)
target_link_libraries(tcc dl)
endif()
install(TARGETS tcc libtcc RUNTIME DESTINATION ${EXE_PATH} LIBRARY DESTINATION ${NATIVE_LIB_PATH} ARCHIVE DESTINATION ${NATIVE_LIB_PATH})
set_target_properties(tcc libtcc PROPERTIES COMPILE_DEFINITIONS "${TCC_NATIVE_DEFINITIONS}")
if("${libtcc_sources}" STRGREATER "")
make_libtcc1("" tcc "${libtcc_ar}" "${definitions}" "${libtcc_includes}" "${libtcc_sources}")
make_libtcc1("" tcc "${libtcc_ar}" "${TCC_NATIVE_DEFINITIONS}" "${libtcc_includes}" "${libtcc_sources}")
endif()
endif()
endif()
if(${cross_enabled})
elseif(${cross_enabled})
add_executable(${cross_name}-tcc tcc.c)
set_target_properties(${cross_name}-tcc PROPERTIES COMPILE_DEFINITIONS "ONE_SOURCE;${definitions}")
install(TARGETS ${cross_name}-tcc RUNTIME DESTINATION ${EXE_PATH})
@ -250,6 +274,7 @@ endif()
if(WIN32)
file(GLOB WIN32_DEFS win32/lib/*.def)
install(FILES ${WIN32_DEFS} DESTINATION lib)
install(FILES tcclib.h DESTINATION include)
install(DIRECTORY include/ DESTINATION include)
install(DIRECTORY win32/include/ DESTINATION include)
install(DIRECTORY win32/examples/ DESTINATION examples)
@ -258,7 +283,7 @@ if(WIN32)
install(FILES ${CMAKE_BINARY_DIR}/libtcc.dll.a DESTINATION libtcc RENAME libtcc.a)
install(FILES libtcc.h DESTINATION libtcc)
else()
install(FILES libtcc.h DESTINATION include)
install(FILES libtcc.h tcclib.h DESTINATION include)
install(DIRECTORY include/ DESTINATION lib/tcc/include)
install(DIRECTORY win32/include/ DESTINATION lib/tcc/win32/include)
install(DIRECTORY include/ DESTINATION lib/tcc/win32/include)