summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-05-22 21:51:59 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2006-05-22 21:51:59 -0400
commita7c95f702c73a332ae2d2283e7bc445876f07bc7 (patch)
treeebd97163e6af98dd259d9a605a3705b61200497e
parentc88f0810c05c5e206baf561f56225a41c776b38f (diff)
downloadgem5-a7c95f702c73a332ae2d2283e7bc445876f07bc7.tar.xz
Clean up libelf handling.
SConstruct: Clean up libelf handling. Required better handling of per-build-root stuff in general (though libelf is the only thing in that category currently). src/SConscript: No libelf-specific stuff in here anymore. src/base/loader/elf_object.cc: Just need to include gelf.h... it includes libelf.h. --HG-- extra : convert_revision : 3d6bdcf8233bda0ac8d08ff777de323df8aa45ae
-rw-r--r--SConstruct43
-rw-r--r--src/SConscript5
-rw-r--r--src/base/loader/elf_object.cc8
3 files changed, 28 insertions, 28 deletions
diff --git a/SConstruct b/SConstruct
index f29d10cef..44fa017a6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -105,9 +105,10 @@ def rfind(l, elt, offs = -1):
# recognize that ALPHA_SE specifies the configuration because it
# follow 'build' in the bulid path.
-# Generate a list of the unique configs that the collected targets
-# reference.
+# Generate a list of the unique build roots and configs that the
+# collected targets reference.
build_paths = []
+build_roots = []
for t in abs_targets:
path_dirs = t.split('/')
try:
@@ -115,9 +116,12 @@ for t in abs_targets:
except:
print "Error: no non-leaf 'build' dir found on target path", t
Exit(1)
- config_dir = os.path.join('/',*path_dirs[:build_top+2])
- if config_dir not in build_paths:
- build_paths.append(config_dir)
+ build_root = os.path.join('/',*path_dirs[:build_top+1])
+ if build_root not in build_roots:
+ build_roots.append(build_root)
+ build_path = os.path.join('/',*path_dirs[:build_top+2])
+ if build_path not in build_paths:
+ build_paths.append(build_path)
###################################################
#
@@ -246,11 +250,6 @@ def no_action(target, source, env):
env.NoAction = Action(no_action, None)
-# libelf build is described in its own SConscript file.
-# SConscript-global is the build in build/libelf shared among all
-# configs.
-env.SConscript('src/libelf/SConscript-global', exports = 'env')
-
###################################################
#
# Define a SCons builder for configuration flag headers.
@@ -292,6 +291,12 @@ config_builder = Builder(emitter = config_emitter, action = config_action)
env.Append(BUILDERS = { 'ConfigFile' : config_builder })
+# base help text
+help_text = '''
+Usage: scons [scons options] [build options] [target(s)]
+
+'''
+
###################################################
#
# Define build environments for selected configurations.
@@ -301,18 +306,24 @@ env.Append(BUILDERS = { 'ConfigFile' : config_builder })
# rename base env
base_env = env
-help_text = '''
-Usage: scons [scons options] [build options] [target(s)]
-
-'''
+# Spme things (just libelf currently) are shared across all configs in
+# a "build root". Need to define how to build these just once for
+# each referenced root.
+build_root_env = {}
+for build_root in build_roots:
+ env = base_env.Copy()
+ env.SConscript('ext/libelf/SConscript',
+ build_dir = os.path.join(build_root, 'libelf'),
+ exports = 'env')
+ build_root_env[build_root] = env
for build_path in build_paths:
print "Building in", build_path
# build_dir is the tail component of build path, and is used to
# determine the build parameters (e.g., 'ALPHA_SE')
(build_root, build_dir) = os.path.split(build_path)
- # Make a copy of the default environment to use for this config.
- env = base_env.Copy()
+ # Make a copy of the build-root environment to use for this config.
+ env = build_root_env[build_root].Copy()
# Set env options according to the build directory config.
sticky_opts.files = []
diff --git a/src/SConscript b/src/SConscript
index a2d5de279..558c447e9 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -326,10 +326,6 @@ env.Command(Split('base/traceflags.hh base/traceflags.cc'),
'base/traceflags.py',
'python $SOURCE $TARGET.base')
-# libelf build is described in its own SConscript file.
-# SConscript-local is the per-config build, which just copies some
-# header files into a place where they can be found.
-SConscript('libelf/SConscript-local', exports = 'env', duplicate=0)
SConscript('python/SConscript', exports = ['env'], duplicate=0)
# This function adds the specified sources to the given build
@@ -358,7 +354,6 @@ def make_objs(sources, env):
# the corresponding build directory to pick up generated include
# files.
env.Append(CPPPATH='.')
-env.Append(CPPPATH='./libelf')
# Debug binary
debugEnv = env.Copy(OBJSUFFIX='.do')
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 165501e1c..79601e9d1 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -30,16 +30,10 @@
// Because of the -Wundef flag we have to do this
#define __LIBELF_INTERNAL__ 0
-// counterintuitive, but the flag below causes libelf to define
-// 64-bit elf types that apparently didn't exist in some older
-// versions of Linux. They seem to be there in 2.4.x, so don't
-// set this now (it causes things to break on 64-bit platforms).
-#define __LIBELF64_LINUX 0
#define __LIBELF_NEED_LINK_H 0
#define __LIBELF_SYMBOL_VERSIONS 0
-#include "libelf/libelf.h"
-#include "libelf/gelf.h"
+#include "gelf.h"
#include "base/loader/elf_object.hh"
#include "base/misc.hh"