Skip to content

Commit

Permalink
Restrict x86 mnemonic to x86-64
Browse files Browse the repository at this point in the history
This resolves an issue where setting the assert config to breakpoint
on ARM will cause the build to fail with an accurate but unhelpful
compiler error.

This restricts the mnemonic to x86-64 architectures, and provides a
more explanatory error.

Addresses issue: #2890

Signed-off-by: Will Marone <[email protected]>
  • Loading branch information
wmaroneAMD authored and jyao1 committed Nov 17, 2024
1 parent 4868c34 commit c5531f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions os_stub/debuglib/debuglib.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ void libspdm_debug_assert(const char *file_name, size_t line_number, const char
#elif (LIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG == LIBSPDM_DEBUG_LIBSPDM_ASSERT_BREAKPOINT)
#if defined(_MSC_EXTENSIONS)
__debugbreak();
#endif
#if defined(__GNUC__)
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
__asm__ __volatile__ ("int $3");
#else
#error Breakpoint asserts are not available on this architecture and/or compiler
#endif
#elif (LIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG == LIBSPDM_DEBUG_LIBSPDM_ASSERT_EXIT)
exit(1);
Expand Down

0 comments on commit c5531f3

Please sign in to comment.