From: Ossama Othman Date: Mon, 23 Feb 2015 18:45:26 +0000 (-0800) Subject: Do not explicitly add "-fPIC" to the compiler command line. X-Git-Tag: 1.2.0+RC1~1914 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8ae092a3b49e2e2c4fd9ad2bf306d5db817b662;p=platform%2Fupstream%2Fiotivity.git Do not explicitly add "-fPIC" to the compiler command line. There is no need to explicitly add "-fPIC" to the compiler command line since the SCons SharedLibary builder will automatically add it. This change also addresses a problem where position independent code was unnecessarily and incorrectly generated for static libraries. IoTivity resource related static libraries are now smaller and code is more efficient as result of removing "-fPIC" from static library generation since the indirection that accompanies position independent code no longer exists (for those static libraries). Change-Id: I6cf57713d97b62f873ded4f4728fbb5e77e28ca6 Signed-off-by: Ossama Othman Reviewed-on: https://gerrit.iotivity.org/gerrit/399 Reviewed-by: Sashi Penta Tested-by: jenkins-iotivity Reviewed-by: Caiwen Zhang Reviewed-by: Sudarshan Prasad --- diff --git a/resource/csdk/SConscript b/resource/csdk/SConscript index cead37e..98af56b 100644 --- a/resource/csdk/SConscript +++ b/resource/csdk/SConscript @@ -40,8 +40,6 @@ liboctbstack_env.AppendUnique(LIBS = ['coap', 'm']) if target_os == 'arduino': liboctbstack_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO']) -else: - liboctbstack_env.AppendUnique(CFLAGS = ['-fPIC']) if target_os in ['darwin', 'ios']: liboctbstack_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE']) @@ -73,5 +71,3 @@ else: static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src) shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src) liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack') - - diff --git a/resource/csdk/libcoap-4.1.1/SConscript b/resource/csdk/libcoap-4.1.1/SConscript index d10bba0..c7bba15 100644 --- a/resource/csdk/libcoap-4.1.1/SConscript +++ b/resource/csdk/libcoap-4.1.1/SConscript @@ -27,7 +27,7 @@ libcoap_env.PrependUnique(CPPPATH = [ if target_os not in ['arduino', 'windows', 'winrt']: libcoap_env.AppendUnique(CPPDEFINES = ['WITH_POSIX']) - libcoap_env.AppendUnique(CFLAGS = ['-std=gnu99', '-fPIC']) + libcoap_env.AppendUnique(CFLAGS = ['-std=gnu99']) if target_os not in ['windows', 'winrt']: libcoap_env.AppendUnique(CFLAGS = ['-Wall', '-ffunction-sections', diff --git a/resource/oc_logger/SConscript b/resource/oc_logger/SConscript index a484ffd..078f725 100644 --- a/resource/oc_logger/SConscript +++ b/resource/oc_logger/SConscript @@ -16,8 +16,8 @@ if target_os == 'android': liboc_logger_env.AppendUnique(LIBS = ['gnustl_static', 'log']) if target_os not in ['arduino', 'windows', 'winrt']: - liboc_logger_env.AppendUnique(CFLAGS = ['-Wall', '-std=c99', '-fPIC']) - liboc_logger_env.AppendUnique(CXXFLAGS = ['-Wall', '-fPIC']) + liboc_logger_env.AppendUnique(CFLAGS = ['-std=c99']) + liboc_logger_env.AppendUnique(CCFLAGS = ['-Wall']) ###################################################################### # Source files and Targets diff --git a/resource/src/SConscript b/resource/src/SConscript index 9f8a376..8a1803b 100644 --- a/resource/src/SConscript +++ b/resource/src/SConscript @@ -19,7 +19,7 @@ oclib_env.AppendUnique(CPPPATH = [ target_os = env.get('TARGET_OS') if target_os not in ['windows', 'winrt']: - oclib_env.AppendUnique(CXXFLAGS = ['-Wall', '-fPIC']) + oclib_env.AppendUnique(CXXFLAGS = ['-Wall']) if target_os == 'android': oclib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])