1 /*---------------------------------------------------------------*/
2 /*--- Begin                             multiarch_main_main.c ---*/
3 /*---------------------------------------------------------------*/
4 
5 /*
6    This file is part of Valgrind, a dynamic binary instrumentation
7    framework.
8 
9    Copyright (C) 2015-2017 Philippe Waroquiers
10 
11    This program is free software; you can redistribute it and/or
12    modify it under the terms of the GNU General Public License as
13    published by the Free Software Foundation; either version 2 of the
14    License, or (at your option) any later version.
15 
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    General Public License for more details.
20 
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24    02110-1301, USA.
25 
26    The GNU General Public License is contained in the file COPYING.
27 
28    Neither the names of the U.S. Department of Energy nor the
29    University of California nor the names of its contributors may be
30    used to endorse or promote products derived from this software
31    without prior written permission.
32 */
33 
34 /* This file is used to have main_main.c compiled with VEXMULTIARCH
35    defined, so that all host and guest arch are callable from LibVEX_Translate
36    and other functions defined in main_main.c.
37    The resulting object file will be put in libvexmultiarch-<platform>-os>.a.
38 
39    The valgrind tools are making the assumption that host and guest are
40    the same. So, no need to drag the full set of archs when
41    linking a tool.
42    The VEX library is nicely split in arch independent and arch dependent
43    objects. Only main_main.c is dragging the various arch specific files.
44    So, main_main.c (the main entry point of the VEX library) is compiled
45    only for the current guest/host arch.
46 
47    This file ensures we recompile main_main.c with all archs activated.
48 
49    So, a VEX user can decide (at link time) to use a 'single arch' VEX lib,
50    or to use a multiarch VEX lib.
51    If t1.o is a 'main' that calls LibVEX_Translate, then
52    to link with a single arch VEX lib, use e.g. the following :
53      gcc -o t1single t1.o -LInst/lib/valgrind  -lvex-amd64-linux -lgcc
54 
55    to link with a multi arch VEX lib, you must insert
56      -lvexmultiarch-amd64-linux *before* -lvex-amd64-linux
57    i.e;
58      gcc -o t1multi t1.o \
59         -LInst/lib/valgrind -lvexmultiarch-amd64-linux -lvex-amd64-linux -lgcc
60 
61    t1single will only be able to translate from amd64 to amd64.
62    t1multi will be able to translate from any arch supported by VEX
63    to any other arch supported by VEX.
64    Note however that multiarch support is experimental and poorly
65    or not tested.
66 */
67 
68 #define VEXMULTIARCH 1
69 #include "main_main.c"
70 
71 /*---------------------------------------------------------------*/
72 /*--- end                               multiarch_main_main.c ---*/
73 /*---------------------------------------------------------------*/
74