1 Reply Latest reply on Nov 3, 2011 6:07 PM by eric@helix.nih.gov

    Strange linking behavior

    eric@helix.nih.gov
      collect2 under openf90 has a stray -n flag

      After most of a day of digging, I figured out why a compile of a mixed FORTRAN/C program produced an ELF executable that triggers the error message

      ELF command alignment not page-aligned..

      when running the dynamic loader

      /lib/ld-linux-x86-64.so.2 --list ./shell.o64

      This check was motivated by the facts that 1) the executable seg-faulted in dl code upon startup, and 2) ldd on the executable complained "not a dynamic executable".

      After checking the verbose output of the linker step, I found a stray "-n" switch in the collect2 command line (which fills a page). This turns off section alignment in generated ELF output.

      How did this show up in the link step produced by openf90? I know that it was never part of the ld flags in my makefile. When I re-run the collect2 step omitting just that switch, everything works fine.

      Any thoughts (including how to suppress this behavior) would be appreciated. System is Gentoo Linux on a dual-processor Xeon box.

      TIA,

      Eric