Commit graph

20 commits

Author SHA1 Message Date
Andreas Hansson
b6aa6d55eb clang/gcc: Fix compilation issues with clang 3.0 and gcc 4.6
This patch addresses a number of minor issues that cause problems when
compiling with clang >= 3.0 and gcc >= 4.6. Most importantly, it
avoids using the deprecated ext/hash_map and instead uses
unordered_map (and similarly so for the hash_set). To make use of the
new STL containers, g++ and clang has to be invoked with "-std=c++0x",
and this is now added for all gcc versions >= 4.6, and for clang >=
3.0. For gcc >= 4.3 and <= 4.5 and clang <= 3.0 we use the tr1
unordered_map to avoid the deprecation warning.

The addition of c++0x in turn causes a few problems, as the
compiler is more stringent and adds a number of new warnings. Below,
the most important issues are enumerated:

1) the use of namespaces is more strict, e.g. for isnan, and all
   headers opening the entire namespace std are now fixed.

2) another other issue caused by the more stringent compiler is the
   narrowing of the embedded python, which used to be a char array,
   and is now unsigned char since there were values larger than 128.

3) a particularly odd issue that arose with the new c++0x behaviour is
   found in range.hh, where the operator< causes gcc to complain about
   the template type parsing (the "<" is interpreted as the beginning
   of a template argument), and the problem seems to be related to the
   begin/end members introduced for the range-type iteration, which is
   a new feature in c++11.

As a minor update, this patch also fixes the build flags for the clang
debug target that used to be shared with gcc and incorrectly use
"-ggdb".
2012-04-14 05:43:31 -04:00
Koan-Sin Tan
7d4f187700 clang: Enable compiling gem5 using clang 2.9 and 3.0
This patch adds the necessary flags to the SConstruct and SConscript
files for compiling using clang 2.9 and later (on Ubuntu et al and OSX
XCode 4.2), and also cleans up a bunch of compiler warnings found by
clang. Most of the warnings are related to hidden virtual functions,
comparisons with unsigneds >= 0, and if-statements with empty
bodies. A number of mismatches between struct and class are also
fixed. clang 2.8 is not working as it has problems with class names
that occur in multiple namespaces (e.g. Statistics in
kernel_stats.hh).

clang has a bug (http://llvm.org/bugs/show_bug.cgi?id=7247) which
causes confusion between the container std::set and the function
Packet::set, and this is currently addressed by not including the
entire namespace std, but rather selecting e.g. "using std::vector" in
the appropriate places.
2012-01-31 12:05:52 -05:00
Andreas Hansson
c2dbfc1d6c MAC: Make gem5 compile and run on MacOSX 10.7.2
Adaptations to make gem5 compile and run on OSX 10.7.2, with a stock
gcc 4.2.1 and the remaining dependencies from macports, i.e. python
2.7,.2 swig 2.0.4, mercurial 2.0. The changes include an adaptation of
the SConstruct to handle non-library linker flags, and Darwin-specific
code to find the memory usage of gem5. A number of Ruby files relied
on ambigious uint (without the 32 suffix) which caused compilation
errors.
2012-01-09 18:08:20 -06:00
Gabe Black
7bc68151b7 LibElf: Build the error management code in libelf.
This change makes some minor changes to get the error management code in
libelf to build on Linux and to build it into the library.
2011-06-12 23:51:59 -07:00
Gabe Black
14b27fc302 scons: Work around for old versions of scons mistaking strings for sequences. 2010-11-09 11:03:40 -08:00
Nathan Binkert
05d8c9acb8 scons: Rename the basic environment from env -> main.
env is used as a local variable all over the place and sometimes it is
easy to get confused as to whether the global env or local env is being
used.  This will become especially important when I change the way we
support our variants.
2009-04-21 17:17:16 -07:00
Nathan Binkert
56e5509bfd scons: Fix two problems with the way that the library path is generated.
1) -L is automatically added, so don't do it ourselves
2) prepend the paths for gzstream and libelf so they are certain to
come first. The problem is that python might add /usr/lib to the path
and the user might have a locally installed version of libelf installed.
2009-04-21 17:17:15 -07:00
Nathan Binkert
dd6ea8797f scons: Require SCons version 0.98.1
This allows me to clean things up so we are up to date with respect to
deprecated features.  There are many features scheduled for permanent failure
in scons 2.0 and 0.98.1 provides the most compatability for that.  It
also paves the way for some nice new features that I will add soon
2009-02-09 20:10:14 -08:00
Nathan Binkert
c55ae0cf5d scons: only use -Wno-pointer-sign with gcc >= 4.3 2008-12-06 14:18:18 -08:00
Ali Saidi
f4bceb9760 Libelf: Append options to CCFLAGS for warning free libelf compile instead of deleting CCFLAGS. Should fix 64bit OS X compile problem. 2008-10-28 21:13:21 -04:00
Nathan Binkert
a589eb4053 SCons: add code to provide a libm5 shared library.
Targets look like libm5_debug.so.  This target can be dynamically
linked into another C++ program and provide just about all of the M5
features.  Additionally, this library is a standalone module that can
be imported into python with an "import libm5_debug" type command
line.
2008-10-09 04:58:23 -07:00
Ali Saidi
bee4d454e8 SCons: Make BATCH options global sticky so libelf is built appropriately.
--HG--
extra : convert_revision : 4bca5c31b8421305d41aac072696964b39d7ff16
2008-04-07 23:40:24 -04:00
Ali Saidi
fed9ee52fc Compiling: Make sure that libelf is also compiled for 64bit on OS X.
--HG--
extra : convert_revision : 9d4f7064e0aa4b6cc6a5bcf0f6fb5289047cd143
2007-11-19 18:23:43 -05:00
Nathan Binkert
c27e23f2e8 style: Check/Fix whitespace on SCons files
--HG--
extra : convert_revision : 46e6b2dd8e1984cbab0ea24c94760794734c0f95
2007-07-28 16:49:20 -07:00
Ali Saidi
1da901d60f This is probably a more scons like way to do this
--HG--
extra : convert_revision : 2cbd05039bbefcc067310098c6c1c1022302fb10
2007-05-31 18:01:07 -04:00
Nathan Binkert
6b6de8aaae obey the m5 style
--HG--
extra : convert_revision : ac0d55c651a2bb6823cbf5a31c6f57ec163730ab
2007-05-31 13:45:03 -07:00
Ali Saidi
473bf1a66a check that m4 is available before trying to use it
--HG--
extra : convert_revision : 8d4d75451fc003e3843e306008ad0632bbf0217a
2007-05-31 15:33:17 -04:00
Ali Saidi
0193476ea7 Fix compiling on Solaris since Nate's libelf change
SConstruct:
    export env after we've set CC/CXX
ext/libelf/SConscript:
    pull in the CC/CXX variables from env. Use gm4 if it exists
ext/libelf/elf_begin.c:
ext/libelf/libelf_allocate.c:
    include errno.h instead of sys/errno.h
ext/libelf/elf_common.h:
    use the more standard uintX_t
ext/libelf/elf_strptr.c:
ext/libelf/elf_update.c:
    include sysmacros.h on Solaris for roundup()

--HG--
extra : convert_revision : ea1aab834029399c445dfa4c9f78febf2c3d8f0c
2007-05-30 17:08:12 -04:00
Steve Reinhardt
8dfd7f9804 Fix M4 command line... wasn't working on zizzer.
A little more concise now.

--HG--
extra : convert_revision : 5cb46832ac7ce7a0be72765e83c8ceb5d8d4b64a
2007-05-28 18:39:35 -04:00
Nathan Binkert
4f0f217c1b Get rid of GNU libelf and its autoconf nastiness and replace
it with FreeBSD's implementation

--HG--
extra : convert_revision : ef9c4551b9a6b54b76a89f286ff9804c55790621
2007-05-26 18:15:22 -07:00