-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix runtime when build with -fsanitize=cfi #1972
Conversation
I tried to build and run a program with So with this option, all class are by default hidden. According to GCC documentation, the C++ visibility support should be |
I now have a doubt. Maybe the |
Yes, need to be careful here not to break backward compatibility. Here is the closest I could find (I didn't test it. Please make sure it indeed works): #ifdef SPDLOG_COMPILED_LIB
# if defined(SPDLOG_SHARED_LIB) && defined(_WIN32)
# ifdef spdlog_EXPORTS
# define SPDLOG_API __declspec(dllexport)
# else
# define SPDLOG_API __declspec(dllimport)
# endif
# elif defined(SPDLOG_SHARED_LIB) && (defined(__GNUC__) || defined(__clang__))
# define SPDLOG_API __attribute__((visibility("default")))
# else // if not SPDLOG_SHARED_LIB or other compiler
# define SPDLOG_API
# endif
# define SPDLOG_INLINE
# undef SPDLOG_HEADER_ONLY
#else // !defined(SPDLOG_COMPILED_LIB)
# define SPDLOG_API
# define SPDLOG_HEADER_ONLY
# define SPDLOG_INLINE inline
#endif // #ifdef SPDLOG_COMPILED_LIB |
@bansan85 any news on this pr? |
Sorry. Thanks for reminding me. I have to take some time to do it. Give me 14 days so I can make so good tests. |
@bansan85 Any news? |
I'm sorry 😕 I think the code should work but at the current time, I don't have the motivation to write some tests 😩 |
I finally took some time to test. Run the command:
|
Thanks @bansan85 |
-flto=thin -fvisibility=hidden -fno-sanitize-trap=cfi
See https://gcc.gnu.org/wiki/Visibility