I am compiling the most basic hello.c on Mac OS X Catalina 10.5.2, Xcode 11.3, ICC 19.0.4.233 20190416
#include <stdio.h> int main() { printf("Hello!\n"); return(0); }
gcc hello.c
ls -l a.out
-rwxr-xr-x 1 dusan staff 12556 Jan 13 17:27 a.out
otool -L a.out
a.out:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
Gcc (or actually clang) gives reasonable binary size and does not link to anything extra.
But with icc, it is a different story:
icc hello.c
ls -l aout
-rwxr-xr-x 1 dusan staff 38856 Jan 13 17:19 a.out
otool -L a.out
a.out:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
Why does icc link to libc++, if I only use C language?
And why is the resulting binary so big?
Setting setting optimization options does not change the result
Binary contains tons of messages, many of which are not necessary, for example the one about Windows XP:
Fatal Error: This program was not built to run on the processor in your system.
Run-Time Check Failure: The variable '%s' is being used without being initialized
Windows XP 64-bit Edition Version 2003 or newer should be used.
Intel(R) Core(TM) Duo processors and compatible Intel processors with supplemental Streaming SIMD Extensions 3 (SSSE3) instruction support
Intel(R) Pentium(R) 4 and compatible Intel processors with Intel(R) Streaming SIMD Extensions 3 (Intel(R) SSE3) instruction support
Intel(R) Pentium(R) 4 and compatible Intel processors. Enables new optimizations in addition to Intel processor-specific optimizations
Intel(R) processors with SSE4.2 and POPCNT instructions support
Please verify that both the operating system and the processor support Intel(R) AVX.
Please verify that both the operating system and the processor support Intel(R) AVX, F16C and RDRAND instructions.
Please verify that both the operating system and the processor support Intel(R) AVX2, BMI, LZCNT, HLE, RTM and FMA instructions.
Please verify that both the operating system and the processor support Intel(R) %s instructions.
Please verify that your application was built with compatible Intel(R) libirc library
Use of incompatible or internally inconsistent Intel(R) libirc library
Run-Time Check Failure: The variable '%s' is being used in %s without being initialized
Cache size is incorrectly reported as 0. Please engage your hardware and/or OS support to address the problem.
irc_msg.cat
Constant propagation error (%s substitution):
FORMAL
RETURN
GLOBAL
I32 %lx != %lx
SI32 %ld != %ld
F32 %f != %f
I64 %lx:%lx != %lx:%lx
SI64 %ld:%ld != %ld:%ld
F64 %f != %f
Bad second argument
Fatal Error: Can not initiate the Heap
Usage: %s input_file output_file
Usage: %s segment_size input_file [-trace]
Conversion from text file %s to binary %s completed
segment_size = 0x%x = %d
Cannot allocate memory to hold segment (size = 0x%x)
Input file: %s corrupted
routine_name = '%s'
file_name = '%s'
prof_dir = '%s'
Dynamic profile created from file %s completed
The allowed processors are: %s.
Error: Buffer overrun occurred, forced exit
Initialization of symbol handler failed. Error code %d
NTDLL module not found
RtlCaptureContext function not found in ntdll.dll
StackWalk is terminated abnormally. Error code %d
Exception is raised during stack walking
Signal %s is raised
Signal %s is raised at 0x%p
SIGSEGV
SIGILL
SIGBUS
SIGFPE
unknown
No error
You must link with libunwind to use traceback functionality
Intel(R) Pentium(R) M and compatible Intel processors
Intel(R) processors with Swing New Instructions support
Intel(R) processors with MOVBE instructions support
Fatal Error: This program was not built to run in your system.
Boundary Run-Time Check Failure for variable '%s'
Boundary Run-Time Check Failure
Conversion Run-Time Check Failure
and
LANG
GENERIC_IA32
CMOV
FXSAVE
SSE2
SSE3
SSSE3
SSE4_1
SSE4_2
MOVBE
POPCNT
PCLMULQDQ
F16C
RDRND
LZCNT
AVX2
AVX512DQ
PTWRITE
KNCNI
AVX512F
RDSEED
AVX512IFMA52
AVX512ER
AVX512PF
AVX512CD
AVX512BW
AVX512VL
AVX512VBMI
AVX512_4FMAPS
AVX512_4VNNIW
AVX512_VPOPCNTDQ
AVX512_BITALG
AVX512_VBMI2
GFNI
VAES
VPCLMULQDQ
AVX512_VNNI
CLWB
RDPID
SHSTK
WBNOINVD
PCONFIG
hw.optional.avx512f
hw.optional.avx512cd
hw.optional.avx512dq
hw.optional.avx512bw
hw.optional.avx512vl
hw.optional.avx512ifma
hw.optional.avx512vbmi