[LLVMdev] Solaris 9 compilation

Gabor Greif gabor at mac.com
Tue Jul 3 04:14:01 PDT 2007


Hi all!

I gave a shot at compiling core llvm with a Solaris 9 machine.
The compiler is FSF gcc 3.4.6. I am building trunk in the release version.
So far I did not run tests (no dejagnu installed).

Here are my findings:

0) Configuring. I had to suppress the solaris tools by:

env AR=/opt/gnu/bin/ar NM=/opt/gnu/bin/nm RANLIB=/opt/gnu/bin/ranlib STRIP=/opt/gnu/bin/strip ../llvm/configure --enable-optimized

00) I had to include the libtool-related .so libraries by
setting LD_LIBRARY_PATH appropriately

1) setrlimit issue:
RLIMIT_RSS is not defined. This seems to be conditionalized for cygwin,
a better test appears to be an "#ifdef RLIMIT_RSS"
See patches below.

2) round() not defined:
http://forum.java.sun.com/thread.jspa?messageID=9567848&tstart=0#9567848
seems to describe this problem.
The solution is simple. (use floor(x + 0.5))
Patch below. This solves the MS compiler issue too (same thing).
Other possibility is to use configure to determine the presence of round().

3) /home/ggreif/llvm/lib/Target/PowerPC/PPCISelLowering.cpp: In function `llvm::SDOperand LowerVAARG(llvm::SDOperand, llvm::SelectionDAG&, int, int, unsigned int, unsigned int, const
llvm::PPCSubtarget&)':
/home/ggreif/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1104: warning: no return statement in function returning non-void

4) /home/ggreif/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp: In member function `virtual bool llvm::SimpleRegisterCoalescing::runOnMachineFunction(llvm::MachineFunction&)':
/home/ggreif/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp:1095: error: `powf' was not declared in this scope
/home/ggreif/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp:1095: warning: unused variable 'powf'

Should we #define powf as pow?
Better possibly is to differentiate by a configure test.
I can come up with a patch.


5) /home/ggreif/llvm/lib/ExecutionEngine/ExecutionEngine.cpp: In member function `llvm::GenericValue llvm::ExecutionEngine::getConstantValue(const llvm::Constant*)':
/home/ggreif/llvm/lib/ExecutionEngine/ExecutionEngine.cpp:497: error: `::fmodf' has not been declared

Should we #define fmodf as fmod?
Better possibly is to differentiate by a configure test.
I can come up with a patch.


6) /home/ggreif/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp: In member function `llvm::GenericValue llvm::Interpreter::executeGEPOperation(llvm::Value*, llvm::gep_type_iterator,
llvm::gep_type_iterator, llvm::ExecutionContext&)':
/home/ggreif/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:798: warning: 'Idx' might be used uninitialized in this function


7) /home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp: In member function `unsigned int <unnamed>::MSILWriter::getBitWidth(const llvm::Type*)':
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp:1449: warning: control reaches end of non-void function
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp: In member function `std::string <unnamed>::MSILWriter::getTypePostfix(const llvm::Type*, bool, bool)':
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp:376: warning: control reaches end of non-void function
llvm[3]: Compiling JIT.cpp for Release build
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp: In member function `std::string <unnamed>::MSILWriter::getPrimitiveTypeName(const llvm::Type*, bool)':
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp:306: warning: control reaches end of non-void function
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp: In member function `std::string <unnamed>::MSILWriter::getConvModopt(unsigned int)':
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp:261: warning: control reaches end of non-void function
llvm[3]: Compiling ValueEnumerator.cpp for Release build
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp: In member function `std::string <unnamed>::MSILWriter::getTypeName(const llvm::Type*, bool, bool)':
/home/ggreif/llvm/lib/Target/MSIL/MSILWriter.cpp:333: warning: control reaches end of non-void function


8) /home/ggreif/llvm/lib/Target/ARM/ARMInstrInfo.cpp: In function `unsigned int llvm::ARM::GetInstSize(llvm::MachineInstr*)':
/home/ggreif/llvm/lib/Target/ARM/ARMInstrInfo.cpp:560: warning: control reaches end of non-void function


9) /home/ggreif/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp: In member function `bool <unnamed>::VRPSolver::below(llvm::Instruction*)':
/home/ggreif/llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1358: warning: control reaches end of non-void function



X) patches:

Index: lib/System/Unix/Program.inc
===================================================================
--- lib/System/Unix/Program.inc (revision 37850)
+++ lib/System/Unix/Program.inc (working copy)
@@ -119,7 +119,7 @@
   getrlimit (RLIMIT_DATA, &r);
   r.rlim_cur = limit;
   setrlimit (RLIMIT_DATA, &r);
-#ifndef __CYGWIN__
+#ifdef RLIMIT_RSS
   // Resident set size.
   getrlimit (RLIMIT_RSS, &r);
   r.rlim_cur = limit;


Index: lib/Support/APInt.cpp
===================================================================
--- lib/Support/APInt.cpp       (revision 37850)
+++ lib/Support/APInt.cpp       (working copy)
@@ -1307,15 +1307,12 @@
   // an IEEE double precision floating point value), then we can use the
   // libc sqrt function which will probably use a hardware sqrt computation.
   // This should be faster than the algorithm below.
+  // using floor(0.5 + x) instead of round(x) because latter is C99.
   if (magnitude < 52) {
-#ifdef _MSC_VER
-    // Amazingly, VC++ doesn't have round().
     return APInt(BitWidth,
-                 uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5);
-#else
-    return APInt(BitWidth,
-                 uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0])))));
-#endif
+                 uint64_t(::floor(0.5
+                                                                 + ::sqrt(::floor(0.5
+                                                                                         + isSingleWord()?VAL:pVal[0])))));
   }

   // Okay, all the short cuts are exhausted. We must compute it. The following


You find these also attached for a garble-free patch experience.

Y) Good news: gmake -j 10 seems to work flawlessly :-)

Z) I volunteer to fill in PRs if these problems persist for the next days.

Cheers,

	Gabor
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: APInt.cpp.diff
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070703/08a7c81f/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.inc.diff
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070703/08a7c81f/attachment-0001.ksh>


More information about the llvm-dev mailing list