diff --git a/SConstruct b/SConstruct index 4268841b33..da140c750a 100644 --- a/SConstruct +++ b/SConstruct @@ -70,6 +70,17 @@ ANDROID_INCLUDES = [ANDROID_TOP + '/bionic/libc/arch-arm/include', ANDROID_TOP + '/bionic/libm/include/arch/arm', ANDROID_TOP + '/bionic/libthread_db/include'] +ANDROID_LINKFLAGS = ['-nostdlib', + '-Bdynamic', + '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', + '-Wl,-dynamic-linker,/system/bin/linker', + '-Wl,--gc-sections', + '-Wl,-z,nocopyreloc', + '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib', + ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', + ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a', + ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o']; + LIBRARY_FLAGS = { 'all': { 'CPPDEFINES': ['ENABLE_LOGGING_AND_PROFILING'] @@ -306,16 +317,7 @@ SAMPLE_FLAGS = { 'CCFLAGS': ANDROID_FLAGS, 'CPPPATH': ANDROID_INCLUDES, 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], - 'LINKFLAGS': ['-nostdlib', - '-Bdynamic', - '-Wl,-T,' + ANDROID_TOP + '/build/core/armelf.x', - '-Wl,-dynamic-linker,/system/bin/linker', - '-Wl,--gc-sections', - '-Wl,-z,nocopyreloc', - '-Wl,-rpath-link=' + ANDROID_TOP + '/out/target/product/generic/obj/lib', - ANDROID_TOP + '/out/target/product/generic/obj/lib/crtbegin_dynamic.o', - ANDROID_TOP + '/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a', - ANDROID_TOP + '/out/target/product/generic/obj/lib/crtend_android.o'], + 'LINKFLAGS': ANDROID_LINKFLAGS, 'LIBS': ['c', 'stdc++', 'm'], 'mode:release': { 'CPPDEFINES': ['SK_RELEASE', 'NDEBUG'] @@ -386,6 +388,11 @@ D8_FLAGS = { 'os:freebsd': { 'LIBS': ['pthread'], }, + 'os:android': { + 'LIBPATH': [ANDROID_TOP + '/out/target/product/generic/obj/lib'], + 'LINKFLAGS': ANDROID_LINKFLAGS, + 'LIBS': ['c', 'stdc++', 'm'], + }, 'os:win32': { 'LIBS': ['winmm', 'ws2_32'], }, diff --git a/src/d8.cc b/src/d8.cc index 4b8fa60934..4b1ab34724 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -97,7 +97,7 @@ Persistent Shell::evaluation_context_; bool CounterMap::Match(void* key1, void* key2) { const char* name1 = reinterpret_cast(key1); const char* name2 = reinterpret_cast(key2); - return strcmp(name1, name2) != 0; + return strcmp(name1, name2) == 0; } diff --git a/src/d8.h b/src/d8.h index 30ec1555b9..f5d63e026c 100644 --- a/src/d8.h +++ b/src/d8.h @@ -89,7 +89,8 @@ class CounterMap { } class Iterator { public: - Iterator(CounterMap* map): map_(&map->hash_map_), entry_(map_->Start()) { } + explicit Iterator(CounterMap* map) + : map_(&map->hash_map_), entry_(map_->Start()) { } void Next() { entry_ = map_->Next(entry_); } bool More() { return entry_ != NULL; } const char* CurrentKey() { return static_cast(entry_->key); }