mirror of
https://github.com/darlinghq/cctools-port.git
synced 2024-11-23 12:19:40 +00:00
Make 'as' relocatable
This commit is contained in:
parent
3f979bbcd7
commit
5674c31aac
@ -29,6 +29,26 @@ int argc,
|
||||
char **argv,
|
||||
char **envp)
|
||||
{
|
||||
/* cctools-port */
|
||||
char libexec[MAXPATHLEN], libexec_old[MAXPATHLEN];
|
||||
unsigned int libexec_len = sizeof(libexec);
|
||||
_Static_assert(sizeof(ASLIBEXECDIR) < sizeof(libexec), "");
|
||||
strcpy(libexec_old, ASLIBEXECDIR);
|
||||
#undef ASLIBEXECDIR
|
||||
const char *ASLIBEXECDIR = libexec;
|
||||
if (!_NSGetExecutablePath(libexec, &libexec_len))
|
||||
{
|
||||
char *p = strrchr(libexec, '/');
|
||||
if (sizeof(libexec) - (p - libexec) < 5)
|
||||
abort();
|
||||
strcpy(p, "/../");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(libexec, libexec_old);
|
||||
}
|
||||
/* cctools-port end */
|
||||
|
||||
const char *LIB = ASLIBEXECDIR;
|
||||
const char *LOCALLIB = ASLIBEXECDIR;
|
||||
const char *AS = "/as";
|
||||
|
Loading…
Reference in New Issue
Block a user