if you’ve ever written C(or c++) on a mac, you’ll know that the so-called gcc is just clang in disguise $ gcc clang: error: no input files most people(fairly) assume that this is just an alias, but this is not true! it’s a binary! $ which gcc /usr/bin/gcc now, what is this binary? i naively assumed that it would just be shelling out to clang but it turns out the answer is more interesting than that. int sub_1000006c4(int arg0, int arg1) { r19 = arg1; r20 = arg0; if (*_mainExecutableToolName.once == -0x1) { if (*(int8_t *)*_mainExecutableToolName.toolName == 0x63 && *(int8_t *)(*_mainExecutableToolName.toolName + 0x1) == 0x63 && *(int8_t *)(*_mainExecutableToolName.toolName + 0x2) == 0x0) { r21 = “clang”; } else { if (strcmp(*_mainExecutableToolName.toolName,…
examining the macOS gcc binary
Advertisement