-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-objdump.html
31 lines (31 loc) · 2.42 KB
/
compile-objdump.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Compiling a cross-platform objdump</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header id="title-block-header">
<h1 class="title">Compiling a cross-platform objdump</h1>
</header>
<p>The version of objdump included in GNU’s binutils is, in theory, capable of understanding executable files for a platform (OS/CPU architecture combination) different from the one you are using. However this is disabled by default and Linux distributions do not bother enabling it. The result is that, for example, trying to view a Mach-O file on Linux will result in the <code>File format not recognized</code> error.</p>
<p>Building your cross-platform version of objdump used to be easy, just use <code>./configure --enable-targets=all</code> when building binutils. However since the repositories of binutils and gdb have been merged things got more complicated.</p>
<p>There might be an easier way to do this, but I don’t know it:</p>
<ul>
<li>In the cloned binutils-gdb repository run <code>./configure --without-gdb --without-gas --without-gdbserver --without-gdbsupport --without-gold --without-gprof --without-ld --without-libiberty --with-binutils</code> (maybe the correct version is <code>--disabled-gdb</code>?)</li>
<li>Edit the generated Makefile, Add the <code>--enable-targets=all</code> option to the <code>configure-binutils</code> and <code>configure-bfd</code> targets, on the same line that contains the <code>--target=${target_alias}</code> option</li>
<li>Run <code>make -j4</code></li>
<li>Your cross-platform objdump is in <code>binutils/objdump</code></li>
</ul>
<p>You can see a list of all supported targets by running <code>objdump -i</code> and set the target explicitly with <code>objdump -b BFDNAME</code>, usually this is not necessary, objdump will determine the correct target on its own. See also <a href="https://sourceware.org/binutils/docs/binutils/Target-Selection.html">Binutils Target Selection</a>.</p>
</body>
</html>