我有以下简短而又简单的C文件,名为composition.c
:
long inside (long a1,long a2)
{
return a1+a2-a1*a2;
}
long outside(long b1,long b2,long b3,long b4)
{
long first_half = inside(b2,b3);
long second_half = inside(b1,b4);
return(first_half+second_half);
}
int main(int argc, char** argv)
{
long answer=outside(3,4,5,6);
return 0;
}
在HighSierra MacBook Air的终端上,我做了gcc -g -O0 composition.c -o composition
和objdump -d composition
,但是后者会产生错误消息:
$ objdump -d composition
composition: file format Mach-O 64-bit x86-64
/Library/Developer/CommandLineTools/usr/bin/objdump: 'composition': truncated or malformed object (bad section index: 3 for symbol at index 2)
所以我要问我的C代码怎么了?
更新:以下是版本详细信息:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ objdump --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Optimized build.
Default target: x86_64-apple-darwin17.7.0
Host CPU: broadwell
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_be - AArch64 (big endian)
arm - ARM
arm64 - ARM64 (little endian)
armeb - ARM (big endian)
thumb - Thumb
thumbeb - Thumb (big endian)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64