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

            Bug ID: 115270
           Summary: gnat doesn't link on 32-bit Linux/sparc
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: dkm at gcc dot gnu.org, ebotcazou at gcc dot gnu.org
  Target Milestone: ---
            Target: sparc-unknown-linux-gnu

When trying to build trunk on 32-bit Linux/sparc for comparison with 32-bit
Solaris/SPARC, the build failed because gnat didn't link:

/vol/gcc/bin/sparc/gld-2.42: ../rts/s-atopri.o: in function
`system__atomic_primitives__lock_free_try_write_64':
/var/gcc/regression/master/6.8.9-gcc-gas-gld-32/build/gcc/ada/rts/s-atopri.adb:67:(.text+0x250):
undefined reference to `__atomic_compare_exchange_8'
collect2: error: ld returned 1 exit status
gnatlink: error when calling
/var/gcc/regression/master/6.8.9-gcc-gas-gld-32/build/gcc/xg++
make[3]: *** [../gcc-interface/Makefile:464: common-tools] Error 4
make[3]: Leaving directory
'/var/gcc/regression/master/6.8.9-gcc-gas-gld-32/build/gcc/ada/tools'
make[2]: *** [Makefile:201: gnattools-native] Error 2
make[2]: Leaving directory
'/var/gcc/regression/master/6.8.9-gcc-gas-gld-32/build/gnattools'

This happened both when configuring with --with-cpu-32=ultrasparc and
--with-cpu=v9.

In hindsight, that's obvious because __atomic_compare_exchange_8 requires
-mv8plus, which AFAICS isn't enabled on 32-bit Linux/sparc and I found no
way to do so.  This is unlike 32-bit Solaris/SPARC, where TARGET_DEFAULT
includes MASK_V8PLUS.

While it's clear the Linux/sparc cannot move to the Solaris default since
it still supports the V8 Leon CPUs, I wonder if it wouldn't be possible
to allow for V8+ with --with-cpu=v9?

There are other possible hacks, like explicitly passing -mv8plus for libgnat
or linking with -latomic, but those would be just that: hacks.

Reply via email to