Closed vtereshkov closed 3 months ago
@vtereshkov Could you tell me your environment? (OS, CPU)
Ubuntu 20.04 (WSL), x86-64.
@vtereshkov I'm not sure, but googled "cannot execute binary file: Exec format error", it caused by WSL? I'm sorry I couldn't help you.
Here is an example program test1.c
:
int main()
{
return 42;
}
If I run
gcc test1.c -o test1gcc
./xcc test1.c -o test1xcc
I get the following two binaries: test1.zip
The GCC version runs as expected, can be disassembled with objdump
, etc. The XCC version fails with the Exec format error
and produces no output with objdump
.
I have compiled the return 42
source code on my environment (Ubuntu/WSL2, x86-64),
and get exactly same binary file as test1xcc
.
I'm not sure why it cannot run on your environment.
$ file test1xcc
test1xcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, no section header
$ objdump -a test1xcc
test1xcc: file format elf64-x86-64
test1xcc
$ uname -a
Linux RTX 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
I get no disassembly output from objdump -d test1xcc
, while objdump -d test1gcc
is OK.
Also, when I upload test1xcc
to http://www.sunshine2k.de/coding/javascript/onlineelfviewer/onlineelfviewer.html, I see the Invalid ELF file
status. The GCC version is again OK.
I was not able to reproduce the problem, I'm sorry I couldn't help you but I will close the issue.