MCPcopy Create free account
hub / github.com/GJDuck/e9patch / checkCompatible

Function checkCompatible

src/e9tool/e9frontend.cpp:2032–2056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2030#define CONFIG_ERRNO 0x1
2031#define CONFIG_MUTEX 0x2
2032static void checkCompatible(const ELF &elf, const ELF &target)
2033{
2034 const Elf64_Sym *config = getELFDynSym(&target, "_stdlib_config");
2035 switch (elf.type)
2036 {
2037 case BINARY_TYPE_PE_EXE: case BINARY_TYPE_PE_DLL:
2038 if (config != nullptr)
2039 warning("binary \"%s\" is incompatible with Windows/PE "
2040 "instrumentation; the \"stdlib.c\" library supports "
2041 "Linux/ELF only", target.filename);
2042 return;
2043 case BINARY_TYPE_ELF_EXE:
2044 if (elf.dynlink || config == nullptr)
2045 return;
2046 if ((config->st_value & CONFIG_ERRNO) == 0 ||
2047 (config->st_value & CONFIG_MUTEX) == 0)
2048 warning("binary \"%s\" is incompatible with statically linked "
2049 "Linux/ELF executable instrumentation; please recompile "
2050 "with the `-DNO_GLIBC=1' option",
2051 target.filename);
2052 return;
2053 default:
2054 return;
2055 }
2056}
2057
2058/*
2059 * Make a call trampoline object.

Callers 1

e9frontend.cppFile · 0.85

Calls 1

warningFunction · 0.85

Tested by

no test coverage detected