From f0002cb3f51ea37e0264c194045116bacd56af71 Mon Sep 17 00:00:00 2001 From: Justin W Smith <103147162+justsmth@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:51:36 -0400 Subject: [PATCH] NASM use default debug format (#1747) ### Issues * Addresses: https://github.com/aws/aws-lc-rs/issues/470 ### Description of changes: * NASM object files were previously setup to always contain debug information, including source file paths. * `-gcv8` produces the ["CodeView 8" format](https://www.nasm.us/doc/nasmdoc8.html#section-8.5.3). * Simply using `-g` will produce the [default debug format](https://www.nasm.us/doc/nasmdoc2.html#section-2.1.14) for the target. * For "release" and "minsizerel" builds, inclusion of debug information is not desirable. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. --------- Co-authored-by: dkostic <25055813+dkostic@users.noreply.github.com> --- crypto/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 3481c4e29f..eb476dc6fd 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -113,7 +113,11 @@ if(NOT OPENSSL_NO_ASM) endif() find_program(NASM_EXECUTABLE nasm) set(CMAKE_ASM_NASM_COMPILER ${NASM_EXECUTABLE}) - set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -gcv8") + if("${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "relwithdebinfo" OR + "${CMAKE_BUILD_TYPE_LOWER}" STREQUAL "debug") + # Provide debug in the default format + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -g") + endif() # On Windows, we use the NASM output. set(ASM_EXT asm)