Fix multiple rpath tccmacho
If multiple rpaths are specified then output multiple LC_RPATH load commands instead of one with : seperator.
This commit is contained in:
parent
03841b6f16
commit
3fd6a05fff
1 changed files with 13 additions and 5 deletions
18
tccmacho.c
18
tccmacho.c
|
@ -1771,11 +1771,19 @@ static void collect_sections(TCCState *s1, struct macho *mo, const char *filenam
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s1->rpath) {
|
if (s1->rpath) {
|
||||||
i = (sizeof(*rpath) + strlen(s1->rpath) + 1 + 7) &-8;
|
char *path = s1->rpath, *end;
|
||||||
rpath = add_lc(mo, LC_RPATH, i);
|
do {
|
||||||
rpath->path = sizeof(*rpath);
|
end = strchr(path, ':');
|
||||||
str = (char*)rpath + rpath->path;
|
if (!end)
|
||||||
strcpy(str, s1->rpath);
|
end = strchr(path, 0);
|
||||||
|
i = (sizeof(*rpath) + (end - path) + 1 + 7) &-8;
|
||||||
|
rpath = add_lc(mo, LC_RPATH, i);
|
||||||
|
rpath->path = sizeof(*rpath);
|
||||||
|
str = (char*)rpath + rpath->path;
|
||||||
|
memcpy(str, path, end - path);
|
||||||
|
str[end - path] = 0;
|
||||||
|
path = end + 1;
|
||||||
|
} while (*end);
|
||||||
}
|
}
|
||||||
|
|
||||||
fileofs = 4096; /* leave space for mach-o headers */
|
fileofs = 4096; /* leave space for mach-o headers */
|
||||||
|
|
Loading…
Reference in a new issue