https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85007

            Bug ID: 85007
           Summary: -b flag to gnatlink not recognized
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: emr-gnu at hev dot psu.edu
  Target Milestone: ---

Attempting to compile a 64-bit Ada package (using a GPR file) with a gcc
configured with:

LDFLAGS_FOR_TARGET='-Wl,-z,relro' ~/gcc-gcc-7.3.0/configure -v
--with-pkgversion='LOCAL 7.3.0' --enable-languages=c,c++,ada
--prefix=/usr/local/gcc-7.3 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/local/gcc-7.3/lib
--without-included-gettext --enable-threads=posix
--libdir=/usr/local/gcc-7.3/lib --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-default-pie --enable-plugin
--enable-objc-gc=auto --with-arch-32=prescott --with-tune=nehalem
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--disable-nls --without-cuda-driver

When you get to the linker stage, the arguments used are:

gnatlink-7.3 -b x86_64-linux-gnu -v -g --for-linker=-Map
--for-linker=../test.map lib1.a lib2.a --GCC=gcc-7.3 -o ../test driver.ali

It is expected to produce a 64-bit output file, but instead you get the error:

GNATLINK 7.3.0
Copyright (C) 1995-2017, Free Software Foundation, Inc.
gcc-7 -c -gnatA -gnatWb -gnatiw -b x86_64-linux-gnu -g -gnatws b~driver.adb
gcc-7.3: error: x86_64-linux-gnu: No such file or directory
gcc-7.3: error: unrecognized command line option '-b'

I understand by default with this configuration (e.g., without the "-b" flag),
it will produce a 64-bit b~driver.o file, however in this case with the output
format explicitly defined, the gnatlink program should be properly converting
the system configuration string to the equivalent "-m64" flag which gcc-7.3
should be accepting.

The more severe error is when the same compiler attempts to generate 32-bit
objects for the same package, using any valid 32-bit linux linker configuration
string and the '-b' gnatlink argument; all produce an error when attempting to
compile the b~driver.o object, since gcc doesn't recognize this option as
valid.  On MULTIARCH targets, gnatlink.adb should probably parse any '-b'
argument string, and translate it to an appropriate '-m32' or '-m64' argument
for the binder compilation stage.

Reply via email to