Assume files w/o obvious OS are Linux (with warning)

instead of giving a fatal error.
This commit is contained in:
Steve Reinhardt 2008-11-20 19:08:46 -08:00
parent ce4c9a7c10
commit 041ca19edc

View file

@ -655,18 +655,22 @@ LiveProcess::create(LiveProcessParams * params)
"executable as a static binary and try again.\n"); "executable as a static binary and try again.\n");
#if THE_ISA == ALPHA_ISA #if THE_ISA == ALPHA_ISA
if (objFile->getArch() != ObjectFile::Alpha)
fatal("Object file architecture does not match compiled ISA (Alpha).");
if (objFile->hasTLS()) if (objFile->hasTLS())
fatal("Object file has a TLS section and single threaded TLS is not\n" fatal("Object file has a TLS section and single threaded TLS is not\n"
" currently supported for Alpha! Please recompile your " " currently supported for Alpha! Please recompile your "
"executable with \n a non-TLS toolchain.\n"); "executable with \n a non-TLS toolchain.\n");
if (objFile->getArch() != ObjectFile::Alpha)
fatal("Object file architecture does not match compiled ISA (Alpha).");
switch (objFile->getOpSys()) { switch (objFile->getOpSys()) {
case ObjectFile::Tru64: case ObjectFile::Tru64:
process = new AlphaTru64Process(params, objFile); process = new AlphaTru64Process(params, objFile);
break; break;
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux: case ObjectFile::Linux:
process = new AlphaLinuxProcess(params, objFile); process = new AlphaLinuxProcess(params, objFile);
break; break;
@ -675,9 +679,13 @@ LiveProcess::create(LiveProcessParams * params)
fatal("Unknown/unsupported operating system."); fatal("Unknown/unsupported operating system.");
} }
#elif THE_ISA == SPARC_ISA #elif THE_ISA == SPARC_ISA
if (objFile->getArch() != ObjectFile::SPARC64 && objFile->getArch() != ObjectFile::SPARC32) if (objFile->getArch() != ObjectFile::SPARC64 &&
objFile->getArch() != ObjectFile::SPARC32)
fatal("Object file architecture does not match compiled ISA (SPARC)."); fatal("Object file architecture does not match compiled ISA (SPARC).");
switch (objFile->getOpSys()) { switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux: case ObjectFile::Linux:
if (objFile->getArch() == ObjectFile::SPARC64) { if (objFile->getArch() == ObjectFile::SPARC64) {
process = new Sparc64LinuxProcess(params, objFile); process = new Sparc64LinuxProcess(params, objFile);
@ -690,6 +698,7 @@ LiveProcess::create(LiveProcessParams * params)
case ObjectFile::Solaris: case ObjectFile::Solaris:
process = new SparcSolarisProcess(params, objFile); process = new SparcSolarisProcess(params, objFile);
break; break;
default: default:
fatal("Unknown/unsupported operating system."); fatal("Unknown/unsupported operating system.");
} }
@ -697,9 +706,13 @@ LiveProcess::create(LiveProcessParams * params)
if (objFile->getArch() != ObjectFile::X86) if (objFile->getArch() != ObjectFile::X86)
fatal("Object file architecture does not match compiled ISA (x86)."); fatal("Object file architecture does not match compiled ISA (x86).");
switch (objFile->getOpSys()) { switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux: case ObjectFile::Linux:
process = new X86LinuxProcess(params, objFile); process = new X86LinuxProcess(params, objFile);
break; break;
default: default:
fatal("Unknown/unsupported operating system."); fatal("Unknown/unsupported operating system.");
} }
@ -707,6 +720,9 @@ LiveProcess::create(LiveProcessParams * params)
if (objFile->getArch() != ObjectFile::Mips) if (objFile->getArch() != ObjectFile::Mips)
fatal("Object file architecture does not match compiled ISA (MIPS)."); fatal("Object file architecture does not match compiled ISA (MIPS).");
switch (objFile->getOpSys()) { switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux: case ObjectFile::Linux:
process = new MipsLinuxProcess(params, objFile); process = new MipsLinuxProcess(params, objFile);
break; break;
@ -718,6 +734,9 @@ LiveProcess::create(LiveProcessParams * params)
if (objFile->getArch() != ObjectFile::Arm) if (objFile->getArch() != ObjectFile::Arm)
fatal("Object file architecture does not match compiled ISA (ARM)."); fatal("Object file architecture does not match compiled ISA (ARM).");
switch (objFile->getOpSys()) { switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux: case ObjectFile::Linux:
process = new ArmLinuxProcess(params, objFile); process = new ArmLinuxProcess(params, objFile);
break; break;