Skip to content

Commit c5531f3

Browse files
wmaroneAMDjyao1
authored andcommitted
Restrict x86 mnemonic to x86-64
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]>
1 parent 4868c34 commit c5531f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

os_stub/debuglib/debuglib.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ void libspdm_debug_assert(const char *file_name, size_t line_number, const char
3737
#elif (LIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG == LIBSPDM_DEBUG_LIBSPDM_ASSERT_BREAKPOINT)
3838
#if defined(_MSC_EXTENSIONS)
3939
__debugbreak();
40-
#endif
41-
#if defined(__GNUC__)
40+
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
4241
__asm__ __volatile__ ("int $3");
42+
#else
43+
#error Breakpoint asserts are not available on this architecture and/or compiler
4344
#endif
4445
#elif (LIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG == LIBSPDM_DEBUG_LIBSPDM_ASSERT_EXIT)
4546
exit(1);

0 commit comments

Comments
 (0)