Skip to content

Commit

Permalink
bug in GCC 5 workaround, see nothings/stb#280
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Bloomberg committed Jan 25, 2017
1 parent d93b73a commit e302bb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 10 additions & 6 deletions include/imq/thirdparty/stb_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,17 @@ static int stbi__sse2_available()

static int stbi__sse2_available()
{
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later
// GCC 4.8+ has a nice way to do this
return __builtin_cpu_supports("sse2");
// This is a fix for https://github.com/nothings/stb/issues/280
#if defined(STBI__X64_TARGET)
// on x64, SSE2 can be assumed to be available.
return 1;
#else
// portable way to do this, preferably without using GCC inline ASM?
// just bail for now.
return 0;
// __builtin_cpu_supports is buggy on GCC 5 and above, causing problems if
// referenced in a shared object, giving missing __cpu_model hidden symbol errors.
// To get around that, just assume that SSE2 is not available on x86.
//
// See https://github.com/nothings/stb/issues/280 for more information.
return 0;
#endif
}
#endif
Expand Down
2 changes: 0 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ project "imq"
includedirs {"include/imq", "grammar", environment.ANTLR_CPP_PATH}
links {environment.ANTLR_LIB}
defines {"_SCL_SECURE_NO_WARNINGS", "IMQ_SHARED_LIB", "IMQ_SHARED_LIB_BUILD"}

pic "On"

prebuildcommands {
"{ECHO} Cleaning grammar",
Expand Down

0 comments on commit e302bb9

Please sign in to comment.