Forum > Other OS
NetBSD ELF format v2
(1/1)
VK2FVAX:
G'day.
Noticed something odd with the ELF versions on my NetBSD desktop install. I have the following output:
mirage:~/src$ ./test
Test
mirage:~/src$ ldd ./test
ldd: ./test: invalid ELF class 2; expected 1
Seems a little odd. What's a Class 2 in this instance?
Interestingly the distro all seems to be built the same way:
mirage:~/src$ file /opt/fpc-3.2.2-amd64/bin/fp
/opt/fpc-3.2.2-amd64/bin/fp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for NetBSD, with debug_info, not stripped
mirage:~/src$ ldd /opt/fpc-3.2.2-amd64/bin/fp
ldd: /opt/fpc-3.2.2-amd64/bin/fp: invalid ELF class 2; expected 1
I'm running the latest stable 9.2.
mirage:~/src$ uname -a
NetBSD mirage.local.net 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
mirage:~/src$
Anyone have a clue why it's emitting v2 ELF's? How do you display the library dependencies with this?
/usr/bin/nm seems to dump the symbol table pretty well.
Any ideas welcome.
Regards,
Al.
marcov:
If it is like FreeBSD, run elfdump -h on a FPC and a distribution binary.
It is possible that NetBSD changed binary format, and the startup code hasn't changed yet.
In the sources, the startup files are at fpc/rtl/netbsd/x86_64.
ccrause:
--- Quote from: VK2FVAX on July 12, 2022, 07:45:03 am ---Seems a little odd. What's a Class 2 in this instance?
--- End quote ---
According to wiki an ELF class (e_ident[EI_CLASS]) of 1 means 32 bit and 2 means 64 bit. So this means your environment is expecting a 32 bit exe and is complaining that it is 64 bit.
VK2FVAX:
Hi Ccrause.
It's a pretty weird one. I wonder what was used to compile fpc-3.2.2 .. maybe the maintainer is running against the trunk with -CURRENT where it's possibly all class2 .. and us poor nuffies on the stable releases from last year are getting class 1 still?
Speculating. It's all very strange.
Going to go and look up "LSB pie executable" vs "LSB executable".
Thanks for the comment.
polluks:
NetBSD 9.1:
I get the same message for a Go binary, seems to be an ldd bug.
Navigation
[0] Message Index