[LLVMdev] Build issues on Solaris

Nathan Keynes Nathan.Keynes at Sun.COM
Tue Aug 11 00:21:48 PDT 2009


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




More information about the llvm-dev mailing list