Disable optimisation depending on compiler type for victim_function in spectre_v2

This commit is contained in:
sk4nz 2022-03-24 14:52:53 +01:00
parent ecd5fbc0bf
commit 0f0dd946cd

View File

@ -46,7 +46,13 @@ safe_target()
// function that makes indirect call
// note that addr will be passed to gadget via %rdi
int
#if defined(__clang__)
victim_function(char* addr, int input) __attribute__ ((optnone))
#elif defined(__GNUC__) || defined(__GNUG__)
__attribute__((optimize("O0"))) victim_function(char* addr, int input)
#else
victim_function(char* addr, int input)
#endif
{
#pragma GCC diagnostic ignored "-Wuninitialized"
unsigned int result, junk = junk;