Ignore:
Timestamp:
Jul 21, 2017, 3:56:36 PM (7 years ago)
Author:
max@…
Message:

Comment out EI_OSABI, and use ELFCLASS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/libk/elf.c

    r265 r270  
    4040static bool_t elf_isValidHeader(Elf_Ehdr *header)
    4141{
    42         if((header->e_ident[EI_CLASS] == ELFCLASS32)
     42        if((header->e_ident[EI_CLASS] == ELFCLASS)
    4343           && (header->e_ident[EI_DATA] == ELFDATA2LSB)
    4444           && (header->e_ident[EI_VERSION] == EV_CURRENT)
     45/*
    4546           && (header->e_ident[EI_OSABI] == ELFOSABI_NONE)
     47*/
    4648           && ((header->e_machine == EM_MIPS) ||
    4749               (header->e_machine == EM_MIPS_RS3_LE) ||
     
    5052                return true;
    5153
    52         if( header->e_ident[EI_CLASS] != ELFCLASS32 )
    53                 printk("\n[ERROR] in %s : Elf is not 32-Binary\n", __FUNCTION__ );
     54        if( header->e_ident[EI_CLASS] != ELFCLASS )
     55                printk("\n[ERROR] in %s : Elf is not 32/64-Binary\n", __FUNCTION__ );
    5456
    5557        if( header->e_ident[EI_DATA] != ELFDATA2LSB )
     
    5860        if( header->e_ident[EI_VERSION] != EV_CURRENT )
    5961                printk("\n[ERROR] in %s : Elf is not in Current Version\n", __FUNCTION__);
    60 
     62/*
    6163        if( header->e_ident[EI_OSABI] != ELFOSABI_NONE )
    6264                printk("\n[ERROR] in %s : Unexpected Elf ABI, need UNIX System V ABI\n", __FUNCTION__ );
    63 
    64         if( (header->e_machine == EM_MIPS) ||
    65             (header->e_machine == EM_MIPS_RS3_LE) ||
    66             (header->e_machine == EM_X86_64) )
     65*/
     66        if( (header->e_machine != EM_MIPS) &&
     67            (header->e_machine != EM_MIPS_RS3_LE) &&
     68            (header->e_machine != EM_X86_64) )
    6769                printk("\n[ERROR] in %s : unexpected core / accept only MIPS or x86_64\n", __FUNCTION__ );
    6870
    69         if( header->e_type == ET_EXEC )
     71        if( header->e_type != ET_EXEC )
    7072                printk("\n[ERROR] in %s : Elf is not executable binary\n", __FUNCTION__ );
    7173
Note: See TracChangeset for help on using the changeset viewer.