mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-06 06:40:07 +08:00
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
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) {
|
||||
i = (sizeof(*rpath) + strlen(s1->rpath) + 1 + 7) &-8;
|
||||
rpath = add_lc(mo, LC_RPATH, i);
|
||||
rpath->path = sizeof(*rpath);
|
||||
str = (char*)rpath + rpath->path;
|
||||
strcpy(str, s1->rpath);
|
||||
char *path = s1->rpath, *end;
|
||||
do {
|
||||
end = strchr(path, ':');
|
||||
if (!end)
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user