If multiple rpaths are specified then output multiple LC_RPATH load commands instead of one with : seperator.
Unified · Split
| @@ -1771,11 +1771,19 @@ static void collect_sections(TCCState *s1, struct macho *mo, const char *filenam · 1770 unmodified lines | |||
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | if (s1->rpath) { | 1773 | if (s1->rpath) { |
| 1774 | i = (sizeof(*rpath) + strlen(s1->rpath) + 1 + 7) &-8; | 1774 | char *path = s1->rpath, *end; |
| 1775 | rpath = add_lc(mo, LC_RPATH, i); | 1775 | do { |
| 1776 | rpath->path = sizeof(*rpath); | 1776 | end = strchr(path, ':'); |
| 1777 | str = (char*)rpath + rpath->path; | 1777 | if (!end) |
| 1778 | strcpy(str, s1->rpath); | 1778 | end = strchr(path, 0); |
| 1779 | i = (sizeof(*rpath) + (end - path) + 1 + 7) &-8; | ||
| 1780 | rpath = add_lc(mo, LC_RPATH, i); | ||
| 1781 | rpath->path = sizeof(*rpath); | ||
| 1782 | str = (char*)rpath + rpath->path; | ||
| 1783 | memcpy(str, path, end - path); | ||
| 1784 | str[end - path] = 0; | ||
| 1785 | path = end + 1; | ||
| 1786 | } while (*end); | ||
| 1779 | } | 1787 | } |
| 1780 | 1788 | ||
| 1781 | fileofs = 4096; /* leave space for mach-o headers */ | 1789 | fileofs = 4096; /* leave space for mach-o headers */ |