Skip to content

mpi_fortran_argv_null_ has incorrect st_size in ompi/mpi/fortran/base/gen-mpi-mangling.pl #7209

@MaskRay

Description

@MaskRay

Background information

What version of Open MPI are you using? (e.g., v1.10.3, v2.1.0, git branch name and hash, etc.)

HEAD (commit ff48070). This bug is also present in openmpi 3.1.0 (built from source), Debian testing libopenmpi-dev 3.1.3-11 and Arch Linux extra/openmpi 4.0.2-2

Details of the problem

The C source definition of mpi_fortran_argvs_null_ ( ompi/include/mpif-c-constants.h) has a st_size field of 8.

#  ompi/.libs/libompi_mpir.a(libompi_mpir_la-ompi_mpi_init.o)
% readelf -Ws ompi/.libs/libompi_mpir.a G mpi_fortran_argvs_null_  | grep mpi_fortran_argvs_null_
   212: 0000000000000008     8 OBJECT  GLOBAL DEFAULT  COM mpi_fortran_argvs_null_
#  ompi/.libs/libompi_mpir.a(libompi_mpir_la-ompi_mpi_init.o) is used to link libmpi.so
% readelf -W --dyn-syms ompi/.libs/libmpi.so | grep mpi_fortran_argvs_null_
   666: 000000000012d130     8 OBJECT  GLOBAL DEFAULT   24 mpi_fortran_argvs_null_

The Fortran source of mpi_fortran_argvs_null_ has (ompi/include/mpif-f08-types.h) a st_size field of 1.

% readelf -Ws ompi/mpi/fortran/use-mpi-f08/.libs/cart_create_f08.o | grep mpi_fortran_argvs_null_
    12: 0000000000000010     1 OBJECT  GLOBAL DEFAULT  COM mpi_fortran_argvs_null_

# cart_create_f08.o is used to link libmpi_usempif08.so

# a) If the linker is lld
% readelf -W --dyn-syms ompi/mpi/fortran/use-mpi-f08/.libs/libmpi_usempif08.so | grep mpi_fortran_argvs_null_ 
   639: 0000000000040e30     1 OBJECT  GLOBAL DEFAULT   24 mpi_fortran_argvs_null_

# b) If the linker is GNU ld
% readelf -W --dyn-syms ompi/mpi/fortran/use-mpi-f08/.libs/libmpi_usempif08.so | grep mpi_fortran_argvs_null_ 
   957: 000000000003dd00     8 OBJECT  GLOBAL DEFAULT   24 mpi_fortran_argvs_null_

The conflict of st_size can cause mpi_fortran_argvs_null_ to lose symbol version information when the linker is GNU ld https://sourceware.org/bugzilla/show_bug.cgi?id=25236 . For example, Debian shipped packages (libopenmpi-dev) have symbol versions and such libraries cannot be linked by lld due to its rigorous check https://bugs.llvm.org/show_bug.cgi?id=43748

% touch a.f90
% mpifort -fuse-ld=lld a.f90
ld.lld: error: corrupt input file: version definition index 0 for symbol mpi_fortran_argv_null_ is out of bounds
>>> defined in /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempif08.so
...

The correct fix is to make sh_size 8 for the Fortran source.

All symbols that have the problem: mpi_fortran_argv_null_, mpi_fortran_weights_empty_, mpi_fortran_unweighted_, mpi_fortran_errcodes_ignore_, mpi_fortran_argvs_null_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions