From: dh79.pyun@samsung.com Date: Tue, 17 Apr 2018 06:31:54 +0000 (+0900) Subject: Fix Asan build errors (#281) X-Git-Tag: accepted/tizen/unified/20180420.081822^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F91%2F176391%2F1;p=platform%2Fupstream%2Fiotivity.git Fix Asan build errors (#281) Remove duplicate variables multiple definition of `g_ESEasySetupResource' multiple definition of `g_ESDevConfResource' multiple definition of `g_ESCoapCloudConfResource' multiple definition of `g_ESWiFiConfResource' https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/281 (cherry picked from commit 0cbbcfa65ff14d751dd1193f75b7c20269e26991) Change-Id: If5f4a7d87e95350d70187cb21e070c5193130487 Signed-off-by: Oleg Ogurtsov Signed-off-by: DoHyun Pyun --- diff --git a/build_common/SConscript b/build_common/SConscript index b373665..e16a27d 100644 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -104,6 +104,7 @@ help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False)) help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False)) +help_vars.Add(BoolVariable('WITH_ASAN', 'Build with Address Sanitizer support', False)) if target_os in targets_disallow_multitransport: diff --git a/extlibs/mbedtls/SConscript b/extlibs/mbedtls/SConscript index cfcec9d..152c4ba 100644 --- a/extlibs/mbedtls/SConscript +++ b/extlibs/mbedtls/SConscript @@ -77,6 +77,11 @@ mbedtls_env.PrependUnique(CPPPATH = [mbedtls_dir]) mbedtls_env.AppendUnique(CPPPATH = [mbedtls_dir+'include/']) mbedtls_env.AppendUnique(CFLAGS = ['-fPIC', '-Wall']) +asan_build = env.get('WITH_ASAN') +print 'Asan build: {}'.format(asan_build) +if asan_build: + mbedtls_env.AppendUnique(CFLAGS = ['-UMBEDTLS_HAVE_ASM']) + ###################################################################### # Source files and Target(s) ###################################################################### diff --git a/extlibs/mbedtls/mbedtls/configs/config-mini-tls1_1.h b/extlibs/mbedtls/mbedtls/configs/config-mini-tls1_1.h index e22363d..2d6d5ac 100644 --- a/extlibs/mbedtls/mbedtls/configs/config-mini-tls1_1.h +++ b/extlibs/mbedtls/mbedtls/configs/config-mini-tls1_1.h @@ -29,7 +29,9 @@ #define MBEDTLS_CONFIG_H /* System support */ +#if !defined(__SANITIZE_ADDRESS__) #define MBEDTLS_HAVE_ASM +#endif #define MBEDTLS_HAVE_TIME /* mbed TLS feature support */ diff --git a/extlibs/mbedtls/mbedtls/configs/config-picocoin.h b/extlibs/mbedtls/mbedtls/configs/config-picocoin.h index 26b24a9..7fe0ee7 100644 --- a/extlibs/mbedtls/mbedtls/configs/config-picocoin.h +++ b/extlibs/mbedtls/mbedtls/configs/config-picocoin.h @@ -33,7 +33,9 @@ #define MBEDTLS_CONFIG_H /* System support */ +#if !defined(__SANITIZE_ADDRESS__) #define MBEDTLS_HAVE_ASM +#endif #define MBEDTLS_HAVE_TIME /* mbed TLS feature support */ diff --git a/extlibs/mbedtls/mbedtls/configs/config-suite-b.h b/extlibs/mbedtls/mbedtls/configs/config-suite-b.h index 3c4804c..45ad8d2 100644 --- a/extlibs/mbedtls/mbedtls/configs/config-suite-b.h +++ b/extlibs/mbedtls/mbedtls/configs/config-suite-b.h @@ -36,7 +36,9 @@ #define MBEDTLS_CONFIG_H /* System support */ +#if !defined(__SANITIZE_ADDRESS__) #define MBEDTLS_HAVE_ASM +#endif #define MBEDTLS_HAVE_TIME /* mbed TLS feature support */ diff --git a/extlibs/mbedtls/mbedtls/configs/config-thread.h b/extlibs/mbedtls/mbedtls/configs/config-thread.h index 990fe08..f1f8ff5 100644 --- a/extlibs/mbedtls/mbedtls/configs/config-thread.h +++ b/extlibs/mbedtls/mbedtls/configs/config-thread.h @@ -35,7 +35,9 @@ #define MBEDTLS_CONFIG_H /* System support */ +#if !defined(__SANITIZE_ADDRESS__) #define MBEDTLS_HAVE_ASM +#endif /* mbed TLS feature support */ #define MBEDTLS_AES_ROM_TABLES diff --git a/extlibs/mbedtls/mbedtls/include/mbedtls/config.h b/extlibs/mbedtls/mbedtls/include/mbedtls/config.h index 9798b39..083c56e 100644 --- a/extlibs/mbedtls/mbedtls/include/mbedtls/config.h +++ b/extlibs/mbedtls/mbedtls/include/mbedtls/config.h @@ -39,6 +39,7 @@ * \{ */ +#if !defined(__SANITIZE_ADDRESS__) /** * \def MBEDTLS_HAVE_ASM * @@ -54,6 +55,7 @@ * Comment to disable the use of assembly code. */ #define MBEDTLS_HAVE_ASM +#endif /** * \def MBEDTLS_HAVE_SSE2 @@ -1404,6 +1406,7 @@ * \{ */ +#if !defined(__SANITIZE_ADDRESS__) /** * \def MBEDTLS_AESNI_C * @@ -1417,6 +1420,7 @@ * This modules adds support for the AES-NI instructions on x86-64 */ #define MBEDTLS_AESNI_C +#endif /** * \def MBEDTLS_AES_C @@ -2006,6 +2010,7 @@ */ #define MBEDTLS_OID_C +#if !defined(__SANITIZE_ADDRESS__) /** * \def MBEDTLS_PADLOCK_C * @@ -2019,6 +2024,7 @@ * This modules adds support for the VIA PadLock on x86. */ #define MBEDTLS_PADLOCK_C +#endif /** * \def MBEDTLS_PEM_PARSE_C diff --git a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c old mode 100755 new mode 100644 index 5c7a2e3..e86e1b9 --- a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c +++ b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c @@ -37,11 +37,6 @@ */ #define SC_ENROLLEE_TAG "ES_SC_ENROLLEE" -EasySetupResource g_ESEasySetupResource; -WiFiConfResource g_ESWiFiConfResource; -CoapCloudConfResource g_ESCoapCloudConfResource; -DevConfResource g_ESDevConfResource; - SCProperties g_SCProperties; static void ReadAccountData(OCRepPayload* payload,void** userdata); diff --git a/service/notification/src/provider/NSProviderCallbackResponse.c b/service/notification/src/provider/NSProviderCallbackResponse.c index e702bab..2902df0 100644 --- a/service/notification/src/provider/NSProviderCallbackResponse.c +++ b/service/notification/src/provider/NSProviderCallbackResponse.c @@ -34,7 +34,7 @@ static NSSubscribeRequestCallback g_subscribeRequestCb = NULL; static NSProviderSyncInfoCallback g_syncCb = NULL; -pthread_mutex_t nsInitMutex; +extern pthread_mutex_t nsInitMutex; void NSRegisterSubscribeRequestCb(NSSubscribeRequestCallback subscribeRequestCb) { diff --git a/service/notification/src/provider/NSProviderMemoryCache.c b/service/notification/src/provider/NSProviderMemoryCache.c index 9e4dd69..484f623 100644 --- a/service/notification/src/provider/NSProviderMemoryCache.c +++ b/service/notification/src/provider/NSProviderMemoryCache.c @@ -34,6 +34,9 @@ } \ } +pthread_mutex_t NSCacheMutex; +pthread_mutexattr_t NSCacheMutexAttr; + NSCacheList * NSProviderStorageCreate() { pthread_mutex_lock(&NSCacheMutex); diff --git a/service/notification/src/provider/NSProviderMemoryCache.h b/service/notification/src/provider/NSProviderMemoryCache.h index df2733d..05440f8 100644 --- a/service/notification/src/provider/NSProviderMemoryCache.h +++ b/service/notification/src/provider/NSProviderMemoryCache.h @@ -57,7 +57,7 @@ bool NSProviderIsTopicSubScribed(NSCacheElement * conTopicList, char * cId, char NSResult NSProviderDeleteConsumerTopic(NSCacheList * conTopicList, NSCacheTopicSubData * topicSubData); -pthread_mutex_t NSCacheMutex; -pthread_mutexattr_t NSCacheMutexAttr; +extern pthread_mutex_t NSCacheMutex; +extern pthread_mutexattr_t NSCacheMutexAttr; #endif /* _NS_PROVIDER_CACHEADAPTER__H_ */ diff --git a/service/notification/src/provider/NSProviderSubscription.c b/service/notification/src/provider/NSProviderSubscription.c index 3116cbb..3d01f3e 100644 --- a/service/notification/src/provider/NSProviderSubscription.c +++ b/service/notification/src/provider/NSProviderSubscription.c @@ -21,6 +21,8 @@ #include "NSProviderSubscription.h" #include "NSProviderListener.h" +NSCacheList * consumerSubList; + NSResult NSInitSubscriptionList() { NS_LOG(DEBUG, "NSInitSubscriptionList - IN"); diff --git a/service/notification/src/provider/NSProviderSubscription.h b/service/notification/src/provider/NSProviderSubscription.h index dd11273..89acd5e 100644 --- a/service/notification/src/provider/NSProviderSubscription.h +++ b/service/notification/src/provider/NSProviderSubscription.h @@ -34,7 +34,7 @@ #include "oic_malloc.h" #include -NSCacheList * consumerSubList; +extern NSCacheList * consumerSubList; NSResult NSInitSubscriptionList(); NSResult NSSetSubscriptionAccessPolicy(bool policy); diff --git a/service/notification/src/provider/NSProviderTopic.c b/service/notification/src/provider/NSProviderTopic.c index 055dc47..f6aa8e9 100644 --- a/service/notification/src/provider/NSProviderTopic.c +++ b/service/notification/src/provider/NSProviderTopic.c @@ -23,6 +23,9 @@ #include "oic_malloc.h" #include +NSCacheList * consumerTopicList; +NSCacheList * registeredTopicList; + NSResult NSSendTopicUpdation(); NSResult NSInitTopicList() diff --git a/service/notification/src/provider/NSProviderTopic.h b/service/notification/src/provider/NSProviderTopic.h index f75a1f5..5c85845 100644 --- a/service/notification/src/provider/NSProviderTopic.h +++ b/service/notification/src/provider/NSProviderTopic.h @@ -42,8 +42,8 @@ typedef struct { NSResult result; } NSTopicSyncResult; -NSCacheList * consumerTopicList; -NSCacheList * registeredTopicList; +extern NSCacheList * consumerTopicList; +extern NSCacheList * registeredTopicList; NSResult NSInitTopicList(); NSTopicList * NSGetTopics(char *consumerId);