summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-07-17 11:09:33 +0200
committerMichael Stahl <mstahl@redhat.com>2013-07-17 15:02:37 +0200
commit72849607ca58694589f69d49b6e781b76584e47d (patch)
treee60639df7b8a0c3eee124129f63ef543fcab3fd7 /solenv
parentfdddcd6dca9b16214b8e980f96b4a3ce95556feb (diff)
gcc-wrapper: improve argument mangling
- properly handle linker arguments which apparently need to be at the end; without this a configure test to determine name of generated executable fails in firebird with MSVC 2012 - support -o *.o - support -o *.dll - support -def:* - ignore -Wl,* Change-Id: Ia256cb10cc76ae834fc39264609bb120320821f6
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gcc-wrappers/wrapper.cxx37
1 files changed, 33 insertions, 4 deletions
diff --git a/solenv/gcc-wrappers/wrapper.cxx b/solenv/gcc-wrappers/wrapper.cxx
index 151979ca7991..42ead2f9bed0 100644
--- a/solenv/gcc-wrappers/wrapper.cxx
+++ b/solenv/gcc-wrappers/wrapper.cxx
@@ -81,17 +81,37 @@ string processccargs(vector<string> rawargs) {
args.append(" -Zc:wchar_t-");
args.append(" -Ob1 -Oxs -Oy-");
+ // apparently these must be at the end
+ // otherwise configure tests may fail
+ string linkargs(" -link");
+
for(vector<string>::iterator i = rawargs.begin(); i != rawargs.end(); ++i) {
args.append(" ");
if(*i == "-o") {
// TODO: handle more than just exe output
++i;
size_t dot=(*i).find_last_of(".");
- if(!(*i).compare(dot+1,3,"obj"))
+ if(!(*i).compare(dot+1,3,"obj") || !(*i).compare(dot+1,1,"o"))
+ {
args.append("-Fo");
+ args.append(*i);
+ }
else if(!(*i).compare(dot+1,3,"exe"))
+ {
args.append("-Fe");
- args.append(*i);
+ args.append(*i);
+ }
+ else if(!(*i).compare(dot+1,3,"dll"))
+ { // apparently cl.exe has no flag for dll?
+ linkargs.append(" -dll -out:");
+ linkargs.append(*i);
+ }
+ else
+ {
+ cerr << "unknonwn -o argument - please adapt gcc-wrapper for \""
+ << (*i) << "\"";
+ exit(1);
+ }
}
else if(*i == "-g")
args.append("-Zi");
@@ -104,19 +124,28 @@ string processccargs(vector<string> rawargs) {
args.append(*i);
}
else if(!(*i).compare(0,2,"-L")) {
- args.append("-link -LIBPATH:"+(*i).substr(2));
+ linkargs.append(" -LIBPATH:"+(*i).substr(2));
}
else if(!(*i).compare(0,2,"-l")) {
- args.append((*i).substr(2)+".lib");
+ linkargs.append(" "+(*i).substr(2)+".lib");
+ }
+ else if(!(*i).compare(0,5,"-def:") || !(*i).compare(0,5,"/def:")) {
+ // why are we invoked with /def:? cl.exe should handle plain
+ // "foo.def" by itself
+ linkargs.append(" " + *i);
}
else if(!(*i).compare(0,12,"-fvisibility")) {
//TODO: drop other gcc-specific options
}
+ else if(!(*i).compare(0,4,"-Wl,")) {
+ //TODO: drop other gcc-specific options
+ }
else if(*i == "-Werror")
args.append("-WX");
else
args.append(*i);
}
+ args.append(linkargs);
return args;
}