Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

Commit

Permalink
build: Fix linux 32-bit assembly config
Browse files Browse the repository at this point in the history
This fixes a bug whereby 32-bit Linux builds would not be able to
use the assembly code as the try_compile command would fail when it
attempted to link with compiler flags

Change-Id: I6e4479fb7926169a7fa5c01876834cdae8c3b637
  • Loading branch information
lenny-lunarg committed Jan 16, 2018
1 parent 331af8e commit 488a6ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ if (WIN32)
endif()
else()
enable_language(ASM-ATT)
set(CMAKE_ASM-ATT_FLAGS "${CMAKE_ASM-ATT_FLAGS} $ENV{ASFLAGS}")
set(CMAKE_ASM-ATT_FLAGS "${CMAKE_ASM-ATT_FLAGS} -I\"${CMAKE_CURRENT_BINARY_DIR}\"")
set(CMAKE_ASM-ATT_COMPILE_FLAGS "${CMAKE_ASM-ATT_COMPILE_FLAGS} $ENV{ASFLAGS}")
set(CMAKE_ASM-ATT_COMPILE_FLAGS "${CMAKE_ASM-ATT_COMPILE_FLAGS} -I\"${CMAKE_CURRENT_BINARY_DIR}\"")

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/asm_test.asm ".intel_syntax noprefix\n.text\n.global sample\nsample:\nmov ecx, [eax + 16]\n")
try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/asm_test.asm)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/asm_test.asm)
if (ASSEMBLER_WORKS)
set(CMAKE_ASM-ATT_FLAGS "$ENV{ASFLAGS} -I\"${CMAKE_CURRENT_BINARY_DIR}\"")
set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain_gas.asm)
add_executable(asm_offset asm_offset.c)
add_dependencies(asm_offset generate_helper_files loader_gen_files)
Expand Down

0 comments on commit 488a6ea

Please sign in to comment.