From ae2ece93da446b53b354b12f2f1dfd0cba6f57b7 Mon Sep 17 00:00:00 2001 From: James Lyon Date: Fri, 26 Apr 2013 00:31:46 +0100 Subject: 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. --- CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 845a311..41dd81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) -- cgit v1.3.1