Fixed i386 calling convention issue and CMake build on i386.

The i386 calling convention expects the callee to pop 1 word of the
stack when performing a struct ret.
This commit is contained in:
James Lyon
2013-04-26 00:31:46 +01:00
parent 1caee8ab3b
commit ae2ece93da
3 changed files with 19 additions and 6 deletions

View File

@ -26,8 +26,10 @@ else()
endif()
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TCC_NATIVE_TARGET "x86_64")
set(TCC_ARCH_DIR "x86_64-linux-gnu")
else()
set(TCC_NATIVE_TARGET "i386")
set(TCC_ARCH_DIR "i386-linux-gnu")
endif()
endif()
@ -44,9 +46,9 @@ else()
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)
if(EXISTS /usr/lib/${TCC_ARCH_DIR}/crti.o)
set(CONFIG_LDDIR lib/${TCC_ARCH_DIR})
set(CONFIG_MULTIARCHDIR ${TCC_ARCH_DIR})
elseif(EXISTS /usr/lib64/crti.o)
set(CONFIG_LDDIR lib64)
endif()
@ -164,7 +166,10 @@ macro(make_tcc native_name cross_name cross_enabled definitions tcc_sources libt
tcctok.h
${tcc_sources}
)
set_target_properties(libtcc PROPERTIES OUTPUT_NAME tcc PREFIX lib LINK_FLAGS "-Wl,--output-def,libtcc.def")
set_target_properties(libtcc PROPERTIES OUTPUT_NAME tcc PREFIX lib)
if(WIN32)
set_target_properties(libtcc PROPERTIES LINK_FLAGS "-Wl,--output-def,libtcc.def")
endif()
add_executable(tcc tcc.c)
target_link_libraries(tcc libtcc)
if(NOT WIN32)