Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def buildSim(cppFlags, dir, type, pgo=None):
# NOTE (dsm 16 Apr 2015): Update flags code to support Pin 2.14 while retaining backwards compatibility
env["CPPFLAGS"] += " -g -std=c++0x -Wall -Wno-unknown-pragmas -fomit-frame-pointer -fno-stack-protector"
env["CPPFLAGS"] += " -MMD -DBIGARRAY_MULTIPLIER=1 -DUSING_XED -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_LINUX"
# NOTE: (mgao Jan 2017): Pin 2.14 requires ABI version of 1002, while gcc-5 and later bumps the API version.
# Switch to gcc-4.x by using -fabi-version=2
# FIXME(mgao): update this when upgraded to Pin 3.x
env["CPPFLAGS"] += " -fabi-version=2 -D_GLIBCXX_USE_CXX11_ABI=0"

# Pin 2.12+ kits have changed the layout of includes, detect whether we need
# source/include/ or source/include/pin/
Expand Down Expand Up @@ -143,7 +147,16 @@ def buildSim(cppFlags, dir, type, pgo=None):
env["CPPPATH"] += ["."]

# HDF5
env["PINLIBS"] += ["hdf5", "hdf5_hl"]
conf = Configure(Environment(), conf_dir=joinpath(buildDir, ".sconf_temp"), log_file=joinpath(buildDir, "sconf.log"))
if conf.CheckLib('hdf5') and conf.CheckLib('hdf5_hl'):
env["PINLIBS"] += ["hdf5", "hdf5_hl"]
elif conf.CheckLib('hdf5_serial') and conf.CheckLib('hdf5_serial_hl'):
# Serial version, in Ubuntu 15.04 and later.
env["PINLIBS"] += ["hdf5_serial", "hdf5_serial_hl"]
env["CPPFLAGS"] += ' -DHDF5INCPREFIX="hdf5/serial/"'
else:
print "ERROR: You need to install libhdf5 in the system"
sys.exit(1)

# Harness needs these defined
env["CPPFLAGS"] += ' -DPIN_PATH="' + joinpath(PINPATH, "intel64/bin/pinbin") + '" '
Expand Down
6 changes: 5 additions & 1 deletion src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ libEnv.SharedLibrary("zsim.so", libSrcs)

# Build tracing utilities (need hdf5 & dynamic linking)
traceEnv = env.Clone()
traceEnv["LIBS"] += ["hdf5", "hdf5_hl"]
if "hdf5" in traceEnv["PINLIBS"]:
traceEnv["LIBS"] += ["hdf5", "hdf5_hl"]
else:
assert "hdf5_serial" in traceEnv["PINLIBS"]
traceEnv["LIBS"] += ["hdf5_serial", "hdf5_serial_hl"]
traceEnv["OBJSUFFIX"] += "t"
traceEnv.Program("dumptrace", ["dumptrace.cpp", "access_tracing.cpp", "memory_hierarchy.cpp"] + commonSrcs)
traceEnv.Program("sorttrace", ["sorttrace.cpp", "access_tracing.cpp"] + commonSrcs)
Expand Down
12 changes: 12 additions & 0 deletions src/access_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,20 @@

#include "access_tracing.h"
#include "bithacks.h"

// Concatenate HDF5 header path prefix with the header file names, because
// Ubuntu 15.04 and later change the HDF5 header path.
#define _STR(x) #x
#define STR(x) _STR(x)
#ifdef HDF5INCPREFIX
#include STR(HDF5INCPREFIX/hdf5.h)
#include STR(HDF5INCPREFIX/hdf5_hl.h)
#else
#include <hdf5.h>
#include <hdf5_hl.h>
#endif
#undef STR
#undef _STR

#define PT_CHUNKSIZE (1024*256u) // 256K records (~6MB)

Expand Down
14 changes: 13 additions & 1 deletion src/hdf5_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <fstream>
// Concatenate HDF5 header path prefix with the header file names, because
// Ubuntu 15.04 and later change the HDF5 header path.
#define _STR(x) #x
#define STR(x) _STR(x)
#ifdef HDF5INCPREFIX
#include STR(HDF5INCPREFIX/hdf5.h)
#include STR(HDF5INCPREFIX/hdf5_hl.h)
#else
#include <hdf5.h>
#include <hdf5_hl.h>
#endif
#undef STR
#undef _STR

#include <fstream>
#include <iostream>
#include <vector>
#include "galloc.h"
Expand Down
11 changes: 11 additions & 0 deletions src/pin_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@
*/

#include "pin_cmd.h"
#include <algorithm>
#include <iostream>
#include <linux/version.h>
#include <sstream>
#include <string>
#include <wordexp.h> //for posix-shell command expansion
#include "config.h"
#include "pin.H"

//Funky macro expansion stuff
#define QUOTED_(x) #x
Expand Down Expand Up @@ -65,6 +68,14 @@ PinCmd::PinCmd(Config* conf, const char* configFile, const char* outputDir, uint
}
wordfree(&p);

if (PIN_PRODUCT_VERSION_MAJOR <= 2 && LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
&& std::find(args.begin(), args.end(), "-injection") == args.end()) {
// FIXME(mgao): hack to bypass kernel version check in Pin 2.x.
// Parent injection.
args.push_back("-injection");
args.push_back("parent");
}

//Load tool
args.push_back("-t");
args.push_back(zsimPath);
Expand Down