IDA C++ SDK 9.2
Loading...
Searching...
No Matches
workarounds.hpp
Go to the documentation of this file.
1// various workarounds/fixes for different compilers
2
3#ifndef _IDA_WORKAROUNDS_H
4#define _IDA_WORKAROUNDS_H
5
6// MS Visual C++:
7// this file should be included once in module (exe or dll) where std::stable_sort() is used
8#ifdef _MSC_VER
9#if (_MSC_VER < 1700) // before VS2012
10// the following fixes unneeded exports caused by use
11// of std::stable_sort, which uses new(std::nothrow)
12// reference: http://social.msdn.microsoft.com/Forums/vstudio/en-US/4692205a-0296-4f41-adbb-fa8339597f5c/unwanted-exports
13
14namespace std { extern const __declspec(selectany) nothrow_t nothrow = nothrow_t(); }
15
16// explanation by Javier Blazquez:
17
18/*
19The reason why this eliminates the _Init_locks export is because the linker
20no longer has to go find and use the nothrow.obj file (part of msvcprt.lib)
21during linking for the definition of std::nothrow, it can just use the
22definition you provided. That nothrow.obj file not only contains the
23definition of std::nothrow, it also contains a dllexport definition of
24std::_Init_locks::operator= (in fact, the only such definition of this
25function anywhere in the standard libraries), so preventing the linker from
26using the standard nothrow.obj at all has the effect of removing this ugly
27export altogether.
28*/
29#endif // (_MSC_VER < 1700)
30#endif // _MSC_VER
31
32#ifdef __LINUX__
33 // suppress dependency on __longjmp_chk
34 // idea stolen from http://code.google.com/p/webm/issues/detail?id=166
35 // this file should be included in modules where longjmp is used
36 #if !defined(__ARM__) && defined(__GNUC_PREREQ) && __GNUC_PREREQ(2,11)
37 #ifndef __X86__
38 __asm__(".symver __longjmp_chk,longjmp@GLIBC_2.2.5");
39 #else
40 __asm__(".symver __longjmp_chk,longjmp@GLIBC_2.0");
41 #endif // !__X86__
42 #endif // __GNUC_PREREQ
43#endif // __LINUX__
44
45#endif // _IDA_WORKAROUNDS_H
46
Definition pro.h:3704
const __declspec(selectany) nothrow_t nothrow
__asm__(".symver __longjmp_chk,longjmp@GLIBC_2.2.5")