Solaris 9 compilation

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

APInt.cpp.diff (1012 Bytes)

Program.inc.diff (424 Bytes)