[LLVMdev] Build issues on Solaris

Edward O'Callaghan eocallaghan at auroraux.org
Tue Aug 18 09:55:39 PDT 2009


Good day Nathan,

If your using the stock GCC with Solaris, I am sorry to inform you its
broken, Please see:
http://llvm.org/docs/GettingStarted.html#brokengcc
Please be warned as your get miss compiles and things will do strange `stuff`.

As can be seen here, the reverse is true for both the GNU binutils and
XPG4 versions of `nm' :

-bash-3.2$ /usr/xpg4/bin/nm -p -u `find . -name libLLVMCore.a` | head


./Debug/lib/libLLVMCore.a[AsmWriter.o]:
0000000000 U __assert
0000000000 U __clzdi2
0000000000 U __udivdi3
0000000000 U __umoddi3
0000000000 U _GLOBAL_OFFSET_TABLE_
0000000000 U _ZdaPv
0000000000 U _ZdlPv
-bash-3.2$ /usr/bin/nm -p -u `find . -name libLLVMCore.a` | head


./Debug/lib/libLLVMCore.a[AsmWriter.o]:
    __assert
    __clzdi2
    __udivdi3
    __umoddi3
    _GLOBAL_OFFSET_TABLE_
    _ZdaPv
    _ZdlPv


-bash-3.2$ /usr/bin/nm -p -g `find . -name libLLVMCore.a` | head


./Debug/lib/libLLVMCore.a[AsmWriter.o]:
0000000000 U __assert
0000000000 U __clzdi2
0000000000 T __i686.get_pc_thunk.bx
0000000000 T __i686.get_pc_thunk.cx
0000000000 U __udivdi3
0000000000 U __umoddi3
0000000000 U _GLOBAL_OFFSET_TABLE_
-bash-3.2$ /opt/gcc4/bin/nm -p -g `find . -name libLLVMCore.a` | head

AsmWriter.o:
00000000 T __i686.get_pc_thunk.cx
         U _GLOBAL_OFFSET_TABLE_
00000000 W _ZnwjPv
00000000 W _ZN4llvm24AssemblyAnnotationWriter17emitFunctionAnnotEPKNS_8FunctionERNS_11raw_ostreamE
00000000 W _ZN4llvm24AssemblyAnnotationWriter24emitBasicBlockStartAnnotEPKNS_10BasicBlockERNS_11raw_ostreamE
00000000 W _ZN4llvm24AssemblyAnnotationWriter22emitBasicBlockEndAnnotEPKNS_10BasicBlockERNS_11raw_ostreamE
00000000 W _ZN4llvm24AssemblyAnnotationWriter20emitInstructionAnnotEPKNS_11InstructionERNS_11raw_ostreamE
00000000 W _ZNK4llvm12PATypeHandlecvPNS_4TypeEEv
-bash-3.2$
-bash-3.2$
-bash-3.2$
-bash-3.2$ /usr/bin/nm -p -u `find . -name libLLVMCore.a` | head


./Debug/lib/libLLVMCore.a[AsmWriter.o]:
    __assert
    __clzdi2
    __udivdi3
    __umoddi3
    _GLOBAL_OFFSET_TABLE_
    _ZdaPv
    _ZdlPv
-bash-3.2$ /opt/gcc4/bin/nm -p -u `find . -name libLLVMCore.a` | head

AsmWriter.o:
         U _GLOBAL_OFFSET_TABLE_
         U _ZTVN4llvm11raw_ostreamE
         U _ZTVN4llvm14raw_os_ostreamE
         U _ZTVN4llvm18raw_string_ostreamE
         U _ZNKSs4sizeEv
         U _ZNKSsixEj
         U _ZNKSs5c_strEv
         U _ZNKSs6lengthEv


I believe this is a bug in the version of `nm` your using, prob /usr/bin/nm .

I recommend configuring your PATH differently and using the GCC from:
http://pkg.auroraux.org/GCC/
( Installs to /opt/gcc4 )

Cheers,
Edward O'Callaghan.

2009/8/11 Nathan Keynes <Nathan.Keynes at sun.com>:
> Hi all,
>
>   I've encountered a couple of minor build issues on Solaris that
> have crept in since 2.5, fixes below:
>
>   1. In lib/Target/X86/X86JITInfo.cpp, there is:
>
> // Check if building with -fPIC
> #if defined(__PIC__) && __PIC__ && defined(__linux__)
> #define ASMCALLSUFFIX "@PLT"
> #else
> #define ASMCALLSUFFIX
> #endif
>
> Which causes a link failure due to the non-PLT relocation that
> results. I'm not sure if this should be
> #if defined(__PIC__) && __PIC__ && (defined(__linux__) ||
> defined(__sun__))
>
> or
>
> #if defined(__PIC__) && __PIC__ && !defined(__APPLE__)
>
> or if it should be a configure test, which might be safer. Are there
> any x86 platforms (other than apple) that don't need PLT-indirect calls?
>
> 2. GenLibDeps.pl was changed in r73228 to remove the -g option from nm
> - this breaks with Sun nm, which needs the -g to emit output
> compatible with the regexps used in GenLibDeps.pl. Reverting this
> change works correctly (although it does print some warnings).
>
> The patch had the comment:
>     Fix the SUS usage of `nm` on Unix platforms such as Solaris or
>     AuroraUX; -u is undefined symbols, and says "those external to each
>     object file" so using -g would seem redundant, The error message
> was
>     as follows: "/usr/xpg4/bin/nm: -e or -g set, -u ignored".
>
> Actually it was the -u that's redundant - the -g was necessary for
> GenLibDeps.pl:
>
> $ nm -p -u libLLVMCore.a
> libLLVMCore.a[AsmWriter.o]:
>     __asert
>     atof
>     _GLOBAL_OFFSET_TABLE_
>     isalnum
>     ... etc ...
>
> $ nm -p -g libLLVMCore.a
> libLLVMCore.a[AsmWriter.o]:
> 0000000000 U __assert
> 0000000000 U atof
> 0000000000 U _GLOBAL_OFFSET_TABLE_
> 0000000000 U isalnum
>
> The latter being what GenLibDeps.pl expects to see. All else being
> equal though, it might be better to change GenLibDeps.pl to recognize
> the first version:
> --- GenLibDeps.pl       (revision 78653)
> +++ GenLibDeps.pl       (working copy)
> @@ -100,7 +100,7 @@
>      print "  <dt><b>$lib</b</dt><dd><ul>\n";
>    }
>    open UNDEFS,
> -    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort |
> uniq |";
> +    "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' -e 's/^ *//'
> | sort | uniq |";
>    my %DepLibs;
>    while (<UNDEFS>) {
>      chomp;
>
> Cheers,
> Nathan
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



-- 
-- 
Edward O'Callaghan
http://www.auroraux.org/
eocallaghan at auroraux dot org




More information about the llvm-dev mailing list