Identifying exectuables with largefile support

Does anyone know of a way to determine if a dynamically linked executable file was created with largefile support?

You can use ldd to determine which is being used, “lib” or “liblf”. With “liblf” bing the large file support library.


umpqua:/tmp% pgf90 -Bdynamic hello.f
umpqua:/tmp% ldd a.out => /lib/ (0x40025000) => /usr/pgi_rel/linux86/5.2/lib/ (0x4015c000) => /lib/ (0x40170000)
        /lib/ => /lib/ (0x40000000)
umpqua:/tmp% pgf90 -Bdynamic -Mlfs hello.f
umpqua:/tmp% ldd a.out => /lib/ (0x40025000) => /usr/pgi_rel/linux86/5.2/liblf/ (0x4015c000) => /lib/ (0x40170000)
        /lib/ => /lib/ (0x40000000)



Using ldd doesn’t work in my case. Instead of using “-Mlfs” option, I have been
using “-L/usr/pgi/linux86/5.1/liblf” to get large file support (since v3.2).
The man page for pgf90 (v5.1) states these two methods are equivalent but
it does not appear they the same. Both methods produce executables that work
correctly, i.e. they can create files >2.1GB. An executable built using
“-L/usr/pgi/linux86/5.1/liblf” looks like an executable built without any
large file support options using ldd. See below:

[enguser@cluster2 ~/pgi]$ pgf90 -V
pgf90 5.1-3

enguser@cluster2 ~/pgi]$ pgf90 -Mlfs bigfile.f -o test_lfs
enguser@cluster2 ~/pgi]$ ldd test_lfs => /lib/i686/ (0x42000000) => /usr/pgi/linux86/5.1/liblf/ (0x40027000) => /lib/i686/ (0x4003b000)

enguser@cluster2 ~/pgi]$ pgf90 bigfile.f -o test_lfs2 -L/usr/pgi/linux86/5.1/liblf
enguser@cluster2 ~/pgi]$ ldd test_lfs2 => /lib/i686/ (0x42000000) => /usr/pgi/linux86/5.1/lib/ (0x40027000) => /lib/i686/ (0x4003b000)
/lib/ => /lib/ (0x40000000)

enguser@cluster2 ~/pgi]$ pgf90 bigfile.f -o test_nolfs
enguser@cluster2 ~/pgi]$ ldd test_nolfs => /lib/i686/ (0x42000000) => /usr/pgi/linux86/5.1/lib/ (0x40027000) => /lib/i686/ (0x4003b000)
/lib/ => /lib/ (0x40000000)

[enguser@cluster2 ~/pgi]$ ls -l test_*
-rwxr-xr-x 1 enguser eng 239424 Sep 17 09:24 test_lfs
-rwxr-xr-x 1 enguser eng 239424 Sep 17 09:24 test_lfs2
-rwxr-xr-x 1 enguser eng 234736 Sep 17 09:24 test_nolfs

[enguser@cluster2 ~/pgi]$ diff test_lfs test_lfs2
Binary files test_lfs and test_lfs2 differ


This is a bit harder and may not work in all cases but let’s give it a try. I compiled a ‘Hello World’ program using no flags, “-L$PGI/5.2/liblf/”, and “-Mlfs”. Next I compared each output of “objdump -x a.out” and noticed that the LOAD filesz in the program header are the same for the large file programs but both were larger than the regular compiled exe. I don’t know if this works for all cases, but it might if the only difference is large file support or no large file support.

While “-L$PGI/5.2/liblf” and “-Mlfs” are equivlent, they do have a subtle difference. When you use “-Mlfs”, the linker is given “$PGI/5.2/liblf” as the “rpath”. rpath acts just like “-L$PGI/5.2/liblf” except that it also sets the location to the runtime libraries. This is why ldd gives “lib” for “-L” and “liblf” for -Mlfs.

To compare the two binaries you should use the output from “nm” or “objdump” since the instruction addresses may vary but the instructions themselves will not.