http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49660

           Summary: 64-bit gcc doesn't enable -mv8plus with -m32 on
                    Solaris/SPARC
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org
                CC: ebotca...@gcc.gnu.org
              Host: sparcv9-sun-solaris2*
            Target: sparcv9-sun-solaris2*
             Build: sparcv9-sun-solaris2*


While testing my amd64-*-solaris2 patches in the sparcv9-sun-solaris2
configuration,
I noticed that all Go tests failed to link:

output is:
Undefined            first referenced

 symbol                  in file

__sync_bool_compare_and_swap_8     
/var/gcc/gcc-4.7.0-20110628/11-gcc-v9/sparcv9-sun-solaris2.11/sparcv8plus/libgo/.libs/libgo.so

__sync_add_and_fetch_8             
/var/gcc/gcc-4.7.0-20110628/11-gcc-v9/sparcv9-sun-solaris2.11/sparcv8plus/libgo/.libs/libgo.so

ld: fatal: symbol referencing errors. No output written to
/var/gcc/gcc-4.7.0-20110628/11-gcc-v9/gcc/testsuite/go/array-1.x

collect2: error: ld returned 1 exit status


The problem can be reduced to the following testcase:

#include <stdint.h>

extern int64_t *val, old, new;

int
cas64 (void)
{
    return __sync_bool_compare_and_swap (val, old, new);
}

If compiled with a sparc-sun-solaris2.11 gcc

$ gcc -S sync.c

it contains no calls to __sync_bool_compare_and_swap_8.

If compiled with a sparcv9-sun-solaris2.11 gcc instead

$ gcc -m32 -S sync.c

it does have a call to that function.  Comparing the -fverbose-asm output,
I see that the only difference in enabled options is that -mv8plus is
present in the first configuation, but missing in the second one.  Indeed,
If I add -mv8plus to the second invocation, the call is gone.

Unfortunately, I don't have a good idea where best to fix this.

Reply via email to