How to tell if an executable is 32-bit or 64-bit on x86-64?
Jonathan Ryshpan
jonrysh at pacbell.net
Sun Jul 3 08:29:37 UTC 2005
On Sat, 2005-07-02 at 23:11 -0500, Jonathan Berry wrote:
> On 7/2/05, Jonathan Ryshpan <jonrysh at pacbell.net> wrote:
> > I have an x86-64 system and sometimes need to find out if a library or
> > executable is built for 32-bit or 64-bit execution. On FC3,
> > file foo.so
> > would produce a message that would do the job, like this:
> > $ file usr/lib*/libssl3.so
> > /usr/lib/libssl3.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped
> > /usr/lib64/libssl3.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), stripped
> > A similar command on FC4 produces something like this:
> > $ file /usr/lib*/libssl3.so
> > /usr/lib/libssl3.so: data, stripped
> > /usr/lib64/libssl3.so: data, stripped
> > which is not very useful.
> >
> > What's the best thing to do: Copy FC3 /etc/magic into FC4? Install the
> > latest file utility from the GNU fileutils?
> >
> > I have submitted this as a bug to Red Hat Bugzilla.
> >
> > jon
>
> Strange, works-for-me:
> $ file /usr/lib*/libssl3.so
> /usr/lib64/libssl3.so: ELF 64-bit LSB shared object, AMD x86-64,
> version 1 (SYSV), stripped
> /usr/lib/libssl3.so: ELF 32-bit LSB shared object, Intel 80386,
> version 1 (SYSV), stripped
>
> $ file --version
> file-4.13
> magic file from /usr/share/file/magic
>
> FC4 x86_64 running the latest FC kernel.
I seem to have led the list down the garden path. I have a ~/.magic
file with these contents:
$ cat .magic
# From Caleb Epstein <cae at bkln.org>
0 string ajkg Shorten compressed audio data
>4 byte >0 - version %d
This is to recognize audio files compressed with the shorten utility.
I also have an /etc/magic file with exactly the same contents. The last
version of file (as I remember it) had a bug that /etc/magic didn't get
handled by file; so I put another copy of the test into ~/.magic. The
new version of file seems to have the additional problem that a ~/.magic
file keeps the file utility from working properly. This is such a mess
that it may be easier to find the bug than to describe it properly.
jon
More information about the fedora-list
mailing list