Generate compiler compatible assembly symbols

Typically when compiling a function `foo`,  GCC will add a prefix `_` to the symbol, i.e., generate `_foo`. But on some platforms, the compiler will not add prefix. option `ENABLE_ASM_UNDERSCORE_PREFIX` change the default name of global symbols in assembly code.
This commit is contained in:
Zhi Guan
2024-04-13 17:37:47 +08:00
parent 8e2c4ebd2f
commit 0daba2e61d
4 changed files with 42 additions and 8 deletions

20
include/gmssl/asm.h Normal file
View File

@@ -0,0 +1,20 @@
/*
* Copyright 2014-2024 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
#ifndef GMSSL_ASM_H
#define GMSSL_ASM_H
#ifdef ENABLE_ASM_UNDERSCORE_PREFIX
# define func(foo) _##foo
#else
# define func(foo) foo
#endif
#endif