summaryrefslogtreecommitdiff
path: root/config/pin_base.mpb
blob: e98e28d631985ade54156c854124c98b796d6cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
project {
  requires += pin

  includes += $(PIN_ROOT)/source/include \
              $(PIN_ROOT)/source/include/pin \
              $(PIN_ROOT)/source/include/pin/gen \
              	  $(PIN_ROOT)/extras/cxx/include \
              	  $(PIN_ROOT)/extras/libstdc++/include \
	          $(PIN_ROOT)/extras/crt/include \
	          $(PIN_ROOT)/extras/crt/include/kernel/uapi \
	          $(PIN_ROOT)/extras/crt/include/kernel/uapi/asm-x86 \
	          $(PIN_ROOT)/libunwind/include \
              $(PIN_ROOT)/extras/components/include \
	          $(PIN_ROOT)/extras/crt/include

  macros += BIGARRAY_MULTIPLIER=1 USING_XED PIN_CRT=1 __PIN__=1

  specific (vc9) {
    runtime_library = 0
    compile_flags += /Oy
  }

  specific (prop:microsoft) {
    runtime_library = MultiThreaded
    ImageHasSafeExceptionHandlers = false

    macros += _ITERATOR_DEBUG_LEVEL=0
  }

  specific (prop:windows) {
    macros += TARGET_WINDOWS _SECURE_SCL=0
    configurations -= Debug

    DisableSpecificWarning += 4530
    IgnoreAllDefaultLibraries = true

    // We need to remove the _DEBUG macro so that Visual Studio does not
    // try to link against the debug C++ libraries. Otherwise, the program
    // will not compile, and will have link errors.
    Debug::macros -= _DEBUG
  }

  specific (gnuace, make) {
    compile_flags += -O3 -funwind-tables -fno-stack-protector -fasynchronous-unwind-tables -fomit-frame-pointer -fno-strict-aliasing -fno-rtti -fPIC -nostdlib -fpermissive -Wno-error=all -fno-exceptions
    compile_flags -= -Wunused-parameter -nostdlib

    libs += xed
    libs += c-dynamic m-dynamic c++ c++abi unwind-dynamic
    ldlibs =
  }

  verbatim (make, macros) {
    ifeq ($(shell uname -s), Darwin)
      CPPFLAGS += -DTARGET_MAC -D__DARWIN_ONLY_UNIX_CONFORMANCE=1 -D__DARWIN_UNIX03=0
      LDFLAGS  += -Wl,-no_new_main
    else
      CPPFLAGS += -DTARGET_LINUX -faligned-new
      LDFLAGS  += -ldl-dynamic
    endif

    // We have to disable hidden symbols since we are not manually exporting
    // the main() function.
    no_hidden_visibility = 1
  }

  verbatim (gnuace, macros) {
    ifeq ($(shell uname -s), Darwin)
      CPPFLAGS += -DTARGET_MAC -D__DARWIN_ONLY_UNIX_CONFORMANCE=1 -D__DARWIN_UNIX03=0
    else
      CPPFLAGS += -DTARGET_LINUX -Wl,--hash-style=sysv -faligned-new
    endif
  }
}

feature(ia32) {
  includes += $(PIN_ROOT)/extras/xed-ia32/include \
              $(PIN_ROOT)/extras/crt/include/arch-x86

  libpaths += $(PIN_ROOT)/ia32/lib \
              $(PIN_ROOT)/ia32/lib-ext \
              $(PIN_ROOT)/extras/xed-ia32/lib \
              $(PIN_ROOT)/extras/components/lib/ia32

  macros += TARGET_IA32 HOST_IA32
  avoids += intel64

  specific (prop:windows) {
    libpaths += $(PIN_ROOT)/ia32/lib \
                $(PIN_ROOT)/ia32/lib-ext

    // DO NOT CHANGE ORDER
    lit_libs += libcpmt libcmt pinvm pin libxed ntdll-32
  }

  specific (make, gnuace) {
    compile_flags += -m32
  }
}

feature(intel64) {
  includes += $(PIN_ROOT)/extras/xed-intel64/include \
              $(PIN_ROOT)/extras/xed-intel64/include/xed \
	          $(PIN_ROOT)/extras/crt/include/arch-x86_64

  libpaths += $(PIN_ROOT)/intel64/lib \
              $(PIN_ROOT)/intel64/lib-ext \
              $(PIN_ROOT)/extras/xed-intel64/lib \
              $(PIN_ROOT)/extras/components/lib/intel64 \
              $(PIN_ROOT)/intel64/runtime/pincrt

  macros += TARGET_IA32E HOST_IA32E
  avoids += ia32

  specific (prop:windows) {
    // DO NOT CHANGE ORDER
    lit_libs += libcpmt libcmt pinvm pin libxed ntdll-64
  }

  specific (make, gnuace) {
    compile_flags += -isystem $(PIN_ROOT)/extras/crt/include/arch-x86_64 -isystem $(PIN_ROOT)/extras/crt/include/kernel/asm-x86_64
  }

}