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 libpgc.so is being used, “lib” or “liblf”. With “liblf” bing the large file support library.

Example:

umpqua:/tmp% pgf90 -Bdynamic hello.f
umpqua:/tmp% ldd a.out
        libc.so.6 => /lib/libc.so.6 (0x40025000)
        libpgc.so => /usr/pgi_rel/linux86/5.2/lib/libpgc.so (0x4015c000)
        libm.so.6 => /lib/libm.so.6 (0x40170000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
umpqua:/tmp% pgf90 -Bdynamic -Mlfs hello.f
umpqua:/tmp% ldd a.out
        libc.so.6 => /lib/libc.so.6 (0x40025000)
        libpgc.so => /usr/pgi_rel/linux86/5.2/liblf/libpgc.so (0x4015c000)
        libm.so.6 => /lib/libm.so.6 (0x40170000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

-Mat

Mat,

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
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
libpgc.so => /usr/pgi/linux86/5.1/liblf/libpgc.so (0x40027000)
libm.so.6 => /lib/i686/libm.so.6 (0x4003b000)


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


enguser@cluster2 ~/pgi]$ pgf90 bigfile.f -o test_nolfs
enguser@cluster2 ~/pgi]$ ldd test_nolfs
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
libpgc.so => /usr/pgi/linux86/5.1/lib/libpgc.so (0x40027000)
libm.so.6 => /lib/i686/libm.so.6 (0x4003b000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (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

Tim

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.