- add("prefix", &Architecture::prefix);
- add("tool", &Loader::tool);
+ vector<string> parts = split(spec, "-");
+ resolve_aliases(parts);
+ for(const string &p: parts)
+ {
+ bool ok = false;
+
+ for(unsigned j=0; (!ok && types[j]); ++j)
+ if(p==types[j])
+ {
+ if(!type.empty() && p!=type)
+ throw invalid_argument("Conflicting type specification");
+ type = p;
+ ok = true;
+ }
+
+ for(unsigned j=0; (!ok && cpus[j]); j+=2)
+ if(p==cpus[j])
+ {
+ if(type.empty())
+ type = cpus[j+1];
+ else if(cpus[j+1]!=type)
+ throw invalid_argument("Conflicting CPU specification");
+ cpu = p;
+ ok = true;
+ }
+
+ for(unsigned j=0; (!ok && fpus[j]); j+=2)
+ if(p==fpus[j])
+ {
+ if(fpus[j+1]!=type)
+ throw invalid_argument("Conflicting FPU specification");
+ fpu = p;
+ ok = true;
+ }
+
+ for(unsigned j=0; (!ok && systems[j]); ++j)
+ if(p==systems[j])
+ {
+ system = p;
+ ok = true;
+ }
+
+ for(unsigned j=0; (!ok && toolchains[j]); ++j)
+ if(p==toolchains[j])
+ {
+ toolchain = p;
+ ok = true;
+ }
+
+ if(!ok && (p=="32" || p=="64"))
+ {
+ bits = lexical_cast<unsigned>(p);
+ ok = true;
+ }
+
+ if(!ok)
+ throw invalid_argument("Unrecognized part in arch specification: "+p);
+ }