From a8ae092a3b49e2e2c4fd9ad2bf306d5db817b662 Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Mon, 23 Feb 2015 10:45:26 -0800 Subject: [PATCH] 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 --- resource/csdk/SConscript | 4 ---- resource/csdk/libcoap-4.1.1/SConscript | 2 +- resource/oc_logger/SConscript | 4 ++-- resource/src/SConscript | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) 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']) -- 2.7.4