[Lldb-commits] [PATCH] lldb - __arm64__ vs __aarch64__ insanity

Paul Osmialowski pawelo at king.net.pl
Thu Jul 3 14:10:16 PDT 2014


It's started with simple program:

#ifdef __i386__
#warning this is __i386__
#else
#warning this is NOT __i386__
#endif

#ifdef __x86_64__
#warning this is __x86_64__
#else
#warning this is NOT __x86_64__
#endif

#ifdef __aarch64__
#warning this is __aarch64__
#else
#warning this is NOT __aarch64__
#endif

#ifdef __arm64__
#warning this is __arm64__
#else
#warning this is NOT __arm64__
#endif

#ifdef __arm__
#warning this is __arm__
#else
#warning this is NOT __arm__
#endif

When cross-compiling on Linux for AArch64 using Linaro toolchain, the pre-processor produces following output:
$ aarch64-linux-gnu-gcc-4.8.2 -Wall -c aarch64.c
aarch64.c:4:2: warning: #warning this is NOT __i386__ [-Wcpp]
 #warning this is NOT __i386__
  ^
aarch64.c:10:2: warning: #warning this is NOT __x86_64__ [-Wcpp]
 #warning this is NOT __x86_64__
  ^
aarch64.c:14:2: warning: #warning this is __aarch64__ [-Wcpp]
 #warning this is __aarch64__
  ^
aarch64.c:22:2: warning: #warning this is NOT __arm64__ [-Wcpp]
 #warning this is NOT __arm64__
  ^
aarch64.c:28:2: warning: #warning this is NOT __arm__ [-Wcpp]
 #warning this is NOT __arm__
  ^

I expect that other cross-compilers define __arm64__ instead of __aarch64__ (or both), so there's my patch that causes checking for both. This is all-or-nothing approach, I did not try to investigate whether any of the parts of affected code are compiled on Linux or MacOSX - I altered all places where __arm64__ was used.
Before applying, it's worth to try if it still builds for ARM64 on MacOSX.

http://reviews.llvm.org/D4379

Files:
  source/Core/Error.cpp
  source/Host/common/Host.cpp
  source/Host/macosx/Host.mm
  source/Host/macosx/Symbols.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
  source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  test/functionalities/data-formatter/data-formatter-objc/main.m
  tools/debugserver/source/DNB.cpp
  tools/debugserver/source/DNBDefs.h
  tools/debugserver/source/MacOSX/MachThreadList.cpp
  tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
  tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
  tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
  tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.h
  tools/debugserver/source/RNBDefs.h
  tools/debugserver/source/RNBRemote.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4379.11066.patch
Type: text/x-patch
Size: 25780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140703/75da7073/attachment.bin>


More information about the lldb-commits mailing list