| 80 | The linker crashes when creating a trivial hello world executable. This is a similar crash when building libmacho: |
| 81 | {{{ |
| 82 | clang++-mp-3.6 -stdlib=libc++ -arch ppc hello_world.cxx |
| 83 | |
| 84 | Thread 0 Crashed: |
| 85 | 0 libc++abi.dylib 0x0000000100353f15 getsectiondata + 73 (getsecbyname.c:428) |
| 86 | 1 libc++abi.dylib 0x00000001003580cf libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Re |
| 87 | gisters_x86_64>::setInfoBasedOnIPRegister(bool) + 105 |
| 88 | 2 libc++abi.dylib 0x0000000100354c74 unw_init_local + 96 |
| 89 | 3 libc++abi.dylib 0x00000001003548e7 _Unwind_RaiseException + 72 |
| 90 | 4 libc++abi.dylib 0x00000001003500e8 __cxa_throw + 104 |
| 91 | 5 ld 0x000000010000ecd6 Options::Options(int, char const**) + 0 |
| 92 | 6 ld 0x000000010000c28f ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 13 |
| 93 | 95 |
| 94 | 7 ld 0x000000010000d2ce ld::tool::InputFiles::InputFiles(Options&, char const**) + 372 |
| 95 | 8 ld 0x000000010000a086 main + 145 |
| 96 | 9 ld 0x0000000100002774 start + 52 |
| 97 | }}} |
| 98 | |
| 99 | I suspect the issue is that getsectiondata is striding by sizeof(struct mach_header_64) but the compiler maybe laid down a struct mach_header. |
| 100 | {{{ |
| 101 | sgp = (struct segment_command_64 *) |
| 102 | ((char *)mhp + sizeof(struct mach_header_64)); |
| 103 | for(i = 0; i < mhp->ncmds; i++){ |
| 104 | if(sgp->cmd == LC_SEGMENT_64){ |
| 105 | }}} |
| 106 | |