I'm always happy to help further your education :-).
On Thu, Nov 20, 2008 at 8:37 PM, Ali Saidi <[EMAIL PROTECTED]> wrote: > I learned something new today. The .note.ABI-tag section isn't > generated by the compiler, but is instead part of crt1.o. So, if you > don't link with crt1.o because you used nasm or gcc -nostdlib there > isn't an .note.ABI-tag. BTW, apparently the reason that compilers > stopped setting the operating system in the elf headers has to do with > either the elf standards body dragging their feet on assigning new > numbers or someone just never bothering to ask and the same number > being used for two different operating systems. > > Ali > > > > > On Nov 20, 2008, at 11:24 PM, Steve Reinhardt wrote: > >> See attached, generated as follows: >> >> % echo "global _start\n_start: hlt" > test.asm >> % nasm -f elf64 test.asm >> % ld -static test.o >> % build/X86_SE/m5.debug configs/example/se.py -c a.out >> M5 Simulator System >> >> Copyright (c) 2001-2008 >> The Regents of The University of Michigan >> All Rights Reserved >> >> >> M5 compiled Nov 17 2008 12:39:07 >> M5 revision 5751:54cb03a1a577549cd113bdc2dcaae9b10016aae2 >> M5 commit date Mon Nov 17 11:22:16 2008 -0800 >> M5 started Nov 20 2008 20:22:58 >> M5 executing on phenom >> command line: build/X86_SE/m5.debug configs/example/se.py -c a.out >> Global frequency set at 1000000000000 ticks per second >> fatal: Unknown/unsupported operating system. >> @ cycle 0 >> [create:build/X86_SE/sim/process.cc, line 704] >> Memory Usage: 583452 KBytes >> >> >> >> On Thu, Nov 20, 2008 at 8:14 PM, Ali Saidi <[EMAIL PROTECTED]> wrote: >>> Could someone send me a binary that doesn't get recognized? I >>> implemented the .note-ABI-tag code to figure out the OS/Arch when it >>> wasn't set on the binary and that section in the file should still >>> exist. I want to figure out what is going on there. >>> >>> Thanks, >>> Ali >>> >>> On Nov 20, 2008, at 10:48 PM, Steve Reinhardt wrote: >>> >>>> changeset db1653549204 in /z/repo/m5 >>>> details: http://repo.m5sim.org/m5?cmd=changeset;node=db1653549204 >>>> description: >>>> Assume files w/o obvious OS are Linux (with warning) >>>> instead of giving a fatal error. >>>> >>>> diffstat: >>>> >>>> 1 file changed, 3 insertions(+) >>>> src/sim/process.cc | 3 +++ >>>> >>>> diffs (85 lines): >>>> >>>> diff -r 32ec0a0e41b2 -r db1653549204 src/sim/process.cc >>>> --- a/src/sim/process.cc Mon Nov 17 12:41:50 2008 -0800 >>>> +++ b/src/sim/process.cc Thu Nov 20 19:08:46 2008 -0800 >>>> @@ -655,18 +655,22 @@ >>>> "executable as a static binary and try again.\n"); >>>> >>>> #if THE_ISA == ALPHA_ISA >>>> + if (objFile->getArch() != ObjectFile::Alpha) >>>> + fatal("Object file architecture does not match compiled ISA >>>> (Alpha)."); >>>> + >>>> if (objFile->hasTLS()) >>>> fatal("Object file has a TLS section and single threaded TLS >>>> is not\n" >>>> " currently supported for Alpha! Please >>>> recompile your " >>>> "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()) { >>>> case ObjectFile::Tru64: >>>> process = new AlphaTru64Process(params, objFile); >>>> break; >>>> >>>> + case ObjectFile::UnknownOpSys: >>>> + warn("Unknown operating system; assuming Linux."); >>>> + // fall through >>>> case ObjectFile::Linux: >>>> process = new AlphaLinuxProcess(params, objFile); >>>> break; >>>> @@ -675,9 +679,13 @@ >>>> fatal("Unknown/unsupported operating system."); >>>> } >>>> #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)."); >>>> switch (objFile->getOpSys()) { >>>> + case ObjectFile::UnknownOpSys: >>>> + warn("Unknown operating system; assuming Linux."); >>>> + // fall through >>>> case ObjectFile::Linux: >>>> if (objFile->getArch() == ObjectFile::SPARC64) { >>>> process = new Sparc64LinuxProcess(params, objFile); >>>> @@ -690,6 +698,7 @@ >>>> case ObjectFile::Solaris: >>>> process = new SparcSolarisProcess(params, objFile); >>>> break; >>>> + >>>> default: >>>> fatal("Unknown/unsupported operating system."); >>>> } >>>> @@ -697,9 +706,13 @@ >>>> if (objFile->getArch() != ObjectFile::X86) >>>> fatal("Object file architecture does not match compiled ISA >>>> (x86)."); >>>> switch (objFile->getOpSys()) { >>>> + case ObjectFile::UnknownOpSys: >>>> + warn("Unknown operating system; assuming Linux."); >>>> + // fall through >>>> case ObjectFile::Linux: >>>> process = new X86LinuxProcess(params, objFile); >>>> break; >>>> + >>>> default: >>>> fatal("Unknown/unsupported operating system."); >>>> } >>>> @@ -707,6 +720,9 @@ >>>> if (objFile->getArch() != ObjectFile::Mips) >>>> fatal("Object file architecture does not match compiled ISA >>>> (MIPS)."); >>>> switch (objFile->getOpSys()) { >>>> + case ObjectFile::UnknownOpSys: >>>> + warn("Unknown operating system; assuming Linux."); >>>> + // fall through >>>> case ObjectFile::Linux: >>>> process = new MipsLinuxProcess(params, objFile); >>>> break; >>>> @@ -718,6 +734,9 @@ >>>> if (objFile->getArch() != ObjectFile::Arm) >>>> fatal("Object file architecture does not match compiled ISA >>>> (ARM)."); >>>> switch (objFile->getOpSys()) { >>>> + case ObjectFile::UnknownOpSys: >>>> + warn("Unknown operating system; assuming Linux."); >>>> + // fall through >>>> case ObjectFile::Linux: >>>> process = new ArmLinuxProcess(params, objFile); >>>> break; >>>> _______________________________________________ >>>> m5-dev mailing list >>>> [email protected] >>>> http://m5sim.org/mailman/listinfo/m5-dev >>>> >>> >>> _______________________________________________ >>> m5-dev mailing list >>> [email protected] >>> http://m5sim.org/mailman/listinfo/m5-dev >>> >> <a.out>_______________________________________________ >> m5-dev mailing list >> [email protected] >> http://m5sim.org/mailman/listinfo/m5-dev > > _______________________________________________ > m5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/m5-dev > _______________________________________________ m5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/m5-dev
