[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ELF header conflict

From: W. J. van der Laan
Subject: ELF header conflict
Date: Mon, 19 Apr 2021 19:59:33 +0000


While trying to debug I bumped into what looks like "mescc -g" generates 
invalid or at least incomplete ELF headers due to incompatibility with 

- The e_shnum (number of sections) in lib/linux/*/elf??-header.hex2 does not 
match what is generated by bloodelf, bloodelf generates 5 section headers 
(NULL, .text, .shstr, .str, .sym) while e_shnum in the hardcoded header is 7 
(NULL, .text, .data, .comment. .shstrtab, .symtab, .strtab)

- due to the above e_shstrndx (index of shared string section) needs to be 2, 
not 4

- The size of .text does not cover libc, only _main and _start (libc normally 
ends up in .data, but this section is not present)

- "--64" is not passed to bloodelf on 64 bit RISC-V—this might be my fault, or 
simply one of the remaining 64-bit issues; the other points do not appear to be 
64-bit specific, though

I had to hack these locally before gdb showed backtraces (Linux itself doesn't 
care). Am I missing something, like, say, a completely different branch/version 
of mescc-tools? I am using the git version from 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]