"R_386_GOTOFF relocation" on x86-solaris2.10 with native ld and GNU as

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm encountering a problem building icu4c-3.8 on this system, with both
self-built GNU-as and gcc:

      * i386-pc-solaris2.10
      * gcc-4.1.1
      * GNU as (both 2.16.1 and 2.18)
      * native ld

Must admit that I have not tried using /usr/sfw/bin/gas (2.15).

Here's a testcase:

        $ cat solaris-visibility.c 
        struct A;
        typedef int (*F)(struct A*);
        extern const struct A a;
        struct A { F f; };
        static int f(struct A* x) { return (x==&a); }
        const struct A a = { f };

This breaks when creating a shared library with optimization and
-fvisibility=hidden:

        $ gcc -shared -fvisibility=hidden -fPIC -O2 solaris-visibility.c -o lib.so
        solaris-visibility.c:6: warning: visibility attribute not supported in this configuration; ignored
        ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccmV6dnn.o: symbol a: relocation must bind locally
        collect2: ld returned 1 exit status

When gcc warns the visibility attribute is ignored, why does it make a
difference then (with optimization only) ?

Without optimization, it works:

        $ gcc -shared -fvisibility=hidden -fPIC solaris-visibility.c -o lib.so
        solaris-visibility.c:6: warning: visibility attribute not supported in this configuration; ignored

Works without -fvisibility=hidden but optimization:

        $ gcc -shared -fPIC -O2 solaris-visibility.c -o lib.so

This is how I configured gcc:

        $ gcc -v
        Using built-in specs.
        Target: i386-pc-solaris2.10
        Configured with: /source/gcc-4.1.1/configure
        --enable-threads=posix --disable-multilib --with-gnu-as
        --with-as=/prefix/i386-pc-solaris2.10/bin/as --without-gnu-ld
        --with-local-prefix=/prefix --disable-nls --disable-static
        --disable-dependency-tracking --prefix=/prefix
        Thread model: posix
        gcc version 4.1.1

Thank you!

/haubi/


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux