From 8f92cb024d0e01f611cad3367749031fef6cc913 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 15 Dec 2011 22:43:01 +0000 Subject: [PATCH] Tweaks to compile the release build with clang. Now if it only would not generate curious code like this one (Ubuntu 11.10's clang 2.9 on i386): 0x080a57ea <+538>: xor %al,%al 0x080a57ec <+540>: test %al,%al 0x080a57ee <+542>: jnz 0x80a57f2 => 0x080a57f0 <+544>: jmp 0x80a57f0 0x080a57f2 <+546>: shl $0x4,%edi git-svn-id: https://svn.eduke32.com/eduke32@2182 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile.common | 5 ++++- polymer/eduke32/build/src/engine.c | 7 +++++++ polymer/eduke32/build/src/kplib.c | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index c57d1b26a..d2ff79281 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -78,7 +78,10 @@ endif ifneq (0,$(RELEASE)) # Debugging disabled - debug=-funswitch-loops -O$(OPTLEVEL) + debug=-O$(OPTLEVEL) + ifneq ($(CC),clang) + debug=-funswitch-loops + endif ifeq (0,$(DEBUGANYWAY)) debug+= -fomit-frame-pointer endif diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index e30206351..ca83a356f 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -1806,6 +1806,13 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum) #undef WALLS_ARE_CONSISTENT +#ifdef __clang__ +int32_t engine_dummy_function_to_keep_symbols(void) +{ + return shlookup[0] | sqrtable[0]; +} +#endif + #if defined(_MSC_VER) && !defined(NOASM) diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 1dd2d6b2c..2b830acbd 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -188,6 +188,13 @@ static int32_t gotcmov = -2, abstab10[1024] ASMNAME("abstab10"); static int32_t qhufval0[1<