Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 46769 Details for
Bug 75420
[TRACKER] eradicator's massive multilib bug
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
gcc-wrapper-multilib.patch
gcc-wrapper-multilib.patch (text/plain), 3.40 KB, created by
Jeremy Huddleston (RETIRED)
on 2004-12-24 01:23:24 UTC
(
hide
)
Description:
gcc-wrapper-multilib.patch
Filename:
MIME Type:
Creator:
Jeremy Huddleston (RETIRED)
Created:
2004-12-24 01:23:24 UTC
Size:
3.40 KB
patch
obsolete
>Index: wrapper-1.4.3.c >=================================================================== >RCS file: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.3.c,v >retrieving revision 1.2 >diff -u -1 -b -p -r1.2 wrapper-1.4.3.c >--- wrapper-1.4.3.c 23 Dec 2004 18:04:06 -0000 1.2 >+++ wrapper-1.4.3.c 24 Dec 2004 09:20:22 -0000 >@@ -25,2 +25,5 @@ > >+#define MAXNEWFLAGS 32 >+#define MAXFLAGLEN 127 >+ > struct wrapper_data { >@@ -32,2 +35,4 @@ struct wrapper_data { > char *path; >+ char newflags[MAXNEWFLAGS][MAXFLAGLEN + 1]; >+ unsigned newflagsCount; > }; >@@ -251,2 +256,4 @@ static void modify_path(struct wrapper_d > >+#define lastOfStr(str, n) ((str) + strlen(str) - (n)) >+ > int main(int argc, char *argv[]) >@@ -257,2 +264,3 @@ int main(int argc, char *argv[]) > int result = 0; >+ char **newargv = argv; > >@@ -295,4 +303,81 @@ int main(int argc, char *argv[]) > >+ /* If this is g{cc,++}{32,64}, we need to add -m{32,64} >+ * otherwise we need to add ${CFLAGS_${ABI}} >+ */ >+ if(!strcmp(lastOfStr(data->bin, 2), "32") ) { >+ strcpy(data->newflags[data->newflagsCount], "-m32"); >+ data->bin[strlen(data->bin) - 2] = '\0'; >+ data->newflagsCount++; >+ } else if (!strcmp(lastOfStr(data->bin, 2), "64") ) { >+ data->bin[strlen(data->bin) - 2] = '\0'; >+ strcpy(data->newflags[data->newflagsCount], "-m64"); >+ data->newflagsCount++; >+ } else if(getenv("ABI")) { >+ char *envar = (char *)malloc(sizeof(char) * >+ (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 )); >+ if(!envar) >+ wrapper_exit("%s wrapper: out of memory\n", argv[0]); >+ >+ /* We use CFLAGS_${ABI} for gcc, g++, g77, etc as they are >+ * the same no matter which compiler we are using. >+ */ >+ sprintf(envar, "CFLAGS_%s", getenv("ABI")); >+ >+ if(getenv(envar)) { >+ const char *newflagsStr = getenv(envar); >+ unsigned s, f; /* start/finish of each flag. f points to >+ * the char AFTER the end (ie the space/\0 >+ */ >+ >+ /* Tokenize the flag list */ >+ for(s=0; s < strlen(newflagsStr); s=f+1) { >+ /* Put s at the start of the next flag */ >+ while(newflagsStr[s] == ' ' || >+ newflagsStr[s] == '\t') >+ s++; >+ if(s == strlen(newflagsStr)) >+ break; >+ >+ f = s + 1; >+ while(newflagsStr[f] != ' ' && >+ newflagsStr[f] != '\t' && >+ newflagsStr[f] != '\0') >+ f++; >+ >+ /* Detect overrun */ >+ if(MAXFLAGLEN < f - s || MAXNEWFLAGS == data->newflagsCount) >+ wrapper_exit("%s wrapper: Exiting due to inadequate buffer space. Preventing buffer overrun.\n", argv[0]); >+ >+ strncpy(data->newflags[data->newflagsCount], newflagsStr + s, f - s); >+ data->newflagsCount++; >+ } >+ } >+ >+ free(envar); >+ } >+ >+ if(data->newflagsCount) { >+ unsigned i; >+ >+ /* Make room for the original, new ones, and the NULL terminator */ >+ newargv = (char **)malloc(sizeof(char *) * (argc + data->newflagsCount + 1)); >+ if(!newargv) >+ wrapper_exit("Unable to allocate enough memory for new argv[]."); >+ >+ /* We just use the existing argv[i] as the start. */ >+ for(i=0; i < argc; i++) { >+ newargv[i] = argv[i]; >+ } >+ >+ /* Now we want to append our newflags list. */ >+ for(; i < argc + data->newflagsCount; i++) { >+ newargv[i] = data->newflags[i - argc]; >+ } >+ >+ /* And now cap it off... */ >+ newargv[i] = NULL; >+ } >+ > /* Ok, do it ... */ >- if (execv(data->bin, argv) < 0) >+ if (execv(data->bin, newargv) < 0) > wrapper_exit("Could not run/locate \"%s\"\n", data->name);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 75420
:
46698
|
46769
|
46850
|
47272
|
47436
|
47440
|
47558
|
47684
|
47826
|
48489
|
49143