Wednesday, May 29, 2024

Re: x64

On Wednesday, May 29, 2024, Gustavo Rios <rios.gustavo@gmail.com> wrote:
Dear OpenBSD-Misc.

i have installed obsd 7.5 amd64. I wrote a small function and apparently, obsd is not generating x64 bit code. I am very confused by the output os file and nm program on my anci c code.

Here you have them:

etosha# file xdr_vopq.o
xdr_vopq.o: ELF 64-bit LSB relocatable, x86-64, version 1
etosha#

That´s ok, the output above reports 64-bit, but when i run nm:

etosha# nm xdr_vopq.o
00000000 W __retguard_1176
00000000 W __retguard_3137
         U __xdri32
         U __xdropq
00000000 T __xdrvopq
00000070 T xdr_vopq
00000000 F xdr_vopq.c
etosha#

Why the address showed are 32-bit. I simply cannot understand this.

Those are offsets in ELF sections, not addresses, and in an object file, not an executable.  You should use the 'readelf' command and read the ELF specification to understand what is in an elf object file.

I've never heard of this ("what's the size of the first field in the nm output of a .o file") as a test for the executable format generated by a system compiler. Is this a test you developed yourself based on testing other systems or something you read about?

Philip Guenther

No comments:

Post a Comment