Raised This Month: $12 Target: $400
 3% 

Someone explain to me why this happening?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-27-2016 , 20:08   Someone explain to me why this happening?
Reply With Quote #1

Ok so I'm working on an SM Ext/AMXX Module (code compiles fine on both SM API and AMXX api in current stage) but I noticed something wierd.

As I already know, SM and AMXX (Not 100% sure if true for AMXX) are compiled with clang,
my project is setup to work on clang-3.8 and gcc(g++)-4.8
Wierd part: Binary size of binary compiled with clang is roughly 2x bigger then version under gcc/g++
PHP Code:
Sizes:
  
AMXX API:
    
clang520KB
    gcc
223KB
  SM API
:
    
clang478KB
    gcc
217KB 
The project statically compiles and links latest source of libbz2 and zlib (at time of thread post) during AMBuild process. Compile flags is as minimal warning disabling as possible (CXX projects get the exception mismatch warning disabled due to SM/AMXX api requiring it), 2 other flags are added onto building 3rd party project code(1 per 3rd party build, other doesn't get it)
Builds were set for optimization (-O3)

Anyone explain to me why clang is producing 2x bigger binary when code variance is practically none existent (except between which API being built against)?

Edit: Digging around compiled files for the project yielded the heavy file size hitters for building with clang being the third party code(zlib, bzip2), zlib ranking highest for most file size.
__________________

Last edited by WildCard65; 07-27-2016 at 20:11.
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-28-2016 , 03:38   Re: Someone explain to me why this happening?
Reply With Quote #2

It would help if we knew which compile flags and/or methods you were using.

Edit: There's likely a reason that the SM AMBuildScript adds in compiler-specific flags for GCC and Clang, sometimes even for specific versions of these compilers.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-28-2016 at 03:52.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-28-2016 , 06:58   Re: Someone explain to me why this happening?
Reply With Quote #3

Flags for all 3 projects:
PHP Code:
cxx.cflags += ( '-pipe''-Wall''-Werror''-msse''-m32''-fvisibility=hidden' )
cxx.cxxflags += ( '-std=c++11''-fno-exceptions''-fvisibility-inlines-hidden' )
cxx.linkflags.append('-m32')

if 
cxx.family == 'gcc':
  
cxx.cflags.append('-mfpmath=sse')

if 
builder.options.build_type == 'optimize':
  
cxx.cflags.append('-O3')

cxx.cflags.append('-fno-omit-frame-pointer'
BZip2 extra flag:
PHP Code:
if bz2_builder.compiler.family == 'gcc':
  
bz2_builder.compiler.cflags.append('-Wno-maybe-uninitialized'
Zlib extra flag:
PHP Code:
if z_builder.compiler.family == 'clang':
  
z_builder.compiler.cflags.append('-Wno-shift-negative-value'
AMXX/SM specific flag:
PHP Code:
if binary_builder.compiler.family == 'clang':
  
binary_builder.compiler.cflags.append('-Wno-implicit-exception-spec-mismatch'
SM specific flag:
PHP Code:
if binary_builder.compiler.like('gcc'):
  
binary_builder.compiler.cflags.append('-Wno-strict-aliasing'
__________________

Last edited by WildCard65; 07-28-2016 at 07:15.
WildCard65 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode