README revision 1.8 1 1.1 christos README for BINUTILS
2 1.1 christos
3 1.1 christos These are the GNU binutils. These are utilities of use when dealing
4 1.1 christos with binary files, either object files or executables. These tools
5 1.1 christos consist of the linker (ld), the assembler (gas), and the profiler
6 1.1 christos (gprof) each of which have their own sub-directory named after them.
7 1.1 christos There is also a collection of other binary tools, including the
8 1.1 christos disassembler (objdump) in this directory. These tools make use of a
9 1.1 christos pair of libraries (bfd and opcodes) and a common set of header files
10 1.1 christos (include).
11 1.1 christos
12 1.1 christos There are README and NEWS files in most of the program sub-directories
13 1.1 christos which give more information about those specific programs.
14 1.1 christos
15 1.1 christos
16 1.3 christos Copyright Notices
17 1.3 christos =================
18 1.3 christos
19 1.3 christos Copyright years on binutils source files may be listed using range
20 1.8 christos notation, e.g., 1991-2021, indicating that every year in the range,
21 1.3 christos inclusive, is a copyrightable year that could otherwise be listed
22 1.3 christos individually.
23 1.3 christos
24 1.3 christos
25 1.1 christos Unpacking and Installation -- quick overview
26 1.1 christos ============================================
27 1.1 christos
28 1.1 christos When you unpack the binutils archive file, you will get a directory
29 1.1 christos called something like `binutils-XXX', where XXX is the number of the
30 1.8 christos release. (Probably 2.36 or higher). This directory contains
31 1.1 christos various files and sub-directories. Most of the files in the top
32 1.1 christos directory are for information and for configuration. The actual
33 1.1 christos source code is in sub-directories.
34 1.1 christos
35 1.8 christos To build binutils you will need a C99 compliant compiler and library.
36 1.8 christos You can just do:
37 1.1 christos
38 1.1 christos cd binutils-XXX
39 1.1 christos ./configure [options]
40 1.1 christos make
41 1.1 christos make install # copies the programs files into /usr/local/bin
42 1.1 christos # by default.
43 1.1 christos
44 1.1 christos This will configure and build all the libraries as well as the
45 1.1 christos assembler, the binutils, and the linker.
46 1.1 christos
47 1.1 christos If you have GNU make, we recommend building in a different directory:
48 1.1 christos
49 1.1 christos mkdir objdir
50 1.1 christos cd objdir
51 1.1 christos ../binutils-XXX/configure [options]
52 1.1 christos make
53 1.1 christos make install
54 1.1 christos
55 1.1 christos This relies on the VPATH feature of GNU make.
56 1.1 christos
57 1.1 christos By default, the binutils will be configured to support the system on
58 1.1 christos which they are built. When doing cross development, use the --target
59 1.1 christos configure option to specify a different target, eg:
60 1.1 christos
61 1.8 christos ./configure --target=powerpc64le-linux
62 1.1 christos
63 1.1 christos The --enable-targets option adds support for more binary file formats
64 1.1 christos besides the default. List them as the argument to --enable-targets,
65 1.1 christos separated by commas. For example:
66 1.1 christos
67 1.8 christos ./configure --enable-targets=powerpc-linux,rs6000-aix
68 1.1 christos
69 1.1 christos The name 'all' compiles in support for all valid BFD targets:
70 1.1 christos
71 1.1 christos ./configure --enable-targets=all
72 1.1 christos
73 1.1 christos On 32-bit hosts though, this support will be restricted to 32-bit
74 1.1 christos target unless the --enable-64-bit-bfd option is also used:
75 1.1 christos
76 1.1 christos ./configure --enable-64-bit-bfd --enable-targets=all
77 1.1 christos
78 1.1 christos You can also specify the --enable-shared option when you run
79 1.1 christos configure. This will build the BFD and opcodes libraries as shared
80 1.1 christos libraries. You can use arguments with the --enable-shared option to
81 1.1 christos indicate that only certain libraries should be built shared; for
82 1.1 christos example, --enable-shared=bfd. The only potential shared libraries in
83 1.1 christos a binutils release are bfd and opcodes.
84 1.1 christos
85 1.1 christos The binutils will be linked against the shared libraries. The build
86 1.1 christos step will attempt to place the correct library in the run-time search
87 1.1 christos path for the binaries. However, in some cases, after you install the
88 1.1 christos binaries, you may have to set an environment variable, normally
89 1.1 christos LD_LIBRARY_PATH, so that the system can find the installed libbfd
90 1.1 christos shared library.
91 1.1 christos
92 1.1 christos On hosts that support shared system libraries the binutils will be
93 1.1 christos linked against them. If you have static versions of the system
94 1.1 christos libraries installed as well and you wish to create static binaries
95 1.1 christos instead then use the LDFLAGS environment variable, like this:
96 1.1 christos
97 1.1 christos ../binutils-XXX/configure LDFLAGS="--static" [more options]
98 1.1 christos
99 1.1 christos Note: the two dashes are important. The binutils make use of the
100 1.1 christos libtool script which has a special interpretation of "-static" when it
101 1.1 christos is in the LDFLAGS environment variable.
102 1.1 christos
103 1.1 christos To build under openVMS/AXP, see the file makefile.vms in the top level
104 1.1 christos directory.
105 1.1 christos
106 1.1 christos
107 1.1 christos Native Language Support
108 1.1 christos =======================
109 1.1 christos
110 1.1 christos By default Native Language Support will be enabled for binutils. On
111 1.1 christos some systems however this support is not present and can lead to error
112 1.1 christos messages such as "undefined reference to `libintl_gettext'" when
113 1.1 christos building there tools. If that happens the NLS support can be disabled
114 1.1 christos by adding the --disable-nls switch to the configure line like this:
115 1.1 christos
116 1.1 christos ../binutils-XXX/configure --disable-nls
117 1.1 christos
118 1.1 christos
119 1.1 christos If you don't have ar
120 1.1 christos ====================
121 1.1 christos
122 1.1 christos If your system does not already have an 'ar' program, the normal
123 1.1 christos binutils build process will not work. In this case, run configure as
124 1.1 christos usual. Before running make, run this script:
125 1.1 christos
126 1.1 christos #!/bin/sh
127 1.1 christos MAKE_PROG="${MAKE-make}"
128 1.1 christos MAKE="${MAKE_PROG} AR=true LINK=true"
129 1.1 christos export MAKE
130 1.1 christos ${MAKE} $* all-libiberty
131 1.1 christos ${MAKE} $* all-intl
132 1.1 christos ${MAKE} $* all-bfd
133 1.1 christos cd binutils
134 1.1 christos MAKE="${MAKE_PROG}"
135 1.1 christos export MAKE
136 1.1 christos ${MAKE} $* ar_DEPENDENCIES= ar_LDADD='../bfd/*.o ../libiberty/*.o `if test -f ../intl/gettext.o; then echo '../intl/*.o'; fi`' ar
137 1.1 christos
138 1.1 christos This script will build an ar program in binutils/ar. Move binutils/ar
139 1.1 christos into a directory on your PATH. After doing this, you can run make as
140 1.1 christos usual to build the complete binutils distribution. You do not need
141 1.1 christos the ranlib program in order to build the distribution.
142 1.1 christos
143 1.1 christos Porting
144 1.1 christos =======
145 1.1 christos
146 1.8 christos Binutils-2.36 supports many different architectures, but there
147 1.1 christos are many more not supported, including some that were supported
148 1.1 christos by earlier versions. We are hoping for volunteers to improve this
149 1.1 christos situation.
150 1.1 christos
151 1.1 christos The major effort in porting binutils to a new host and/or target
152 1.1 christos architecture involves the BFD library. There is some documentation
153 1.1 christos in ../bfd/doc. The file ../gdb/doc/gdbint.texinfo (distributed
154 1.1 christos with gdb-5.x) may also be of help.
155 1.1 christos
156 1.1 christos Reporting bugs
157 1.1 christos ==============
158 1.1 christos
159 1.8 christos Please report bugs via
160 1.1 christos
161 1.8 christos https://sourceware.org/bugzilla/enter_bug.cgi?product=binutils
162 1.1 christos
163 1.1 christos Please include the following in bug reports:
164 1.1 christos
165 1.1 christos - A description of exactly what went wrong, and exactly what should have
166 1.1 christos happened instead.
167 1.1 christos
168 1.1 christos - The configuration name(s) given to the "configure" script. The
169 1.1 christos "config.status" file should have this information. This is assuming
170 1.1 christos you built binutils yourself. If you didn't build binutils youself,
171 1.1 christos then we need information regarding your machine and operating system,
172 1.1 christos and it may be more appropriate to report bugs to wherever you obtained
173 1.1 christos binutils.
174 1.1 christos
175 1.1 christos - The options given to the tool (gas, objcopy, ld etc.) at run time.
176 1.1 christos
177 1.1 christos - The actual input file that caused the problem.
178 1.1 christos
179 1.1 christos Always mention the version number you are running; this is printed by
180 1.1 christos running any of the binutils with the --version option. We appreciate
181 1.1 christos reports about bugs, but we do not promise to fix them, particularly so
182 1.1 christos when the bug report is against an old version. If you are able, please
183 1.3 christos consider building the latest tools from git to check that your bug has
184 1.1 christos not already been fixed.
185 1.1 christos
186 1.1 christos When reporting problems about gas and ld, it's useful to provide a
187 1.1 christos testcase that triggers the problem. In the case of a gas problem, we
188 1.1 christos want input files to gas and command line switches used. The inputs to
189 1.1 christos gas are _NOT_ .c or .i files, but rather .s files. If your original
190 1.1 christos source was a C program, you can generate the .s file and see the command
191 1.1 christos line options by passing -v -save-temps to gcc in addition to all the
192 1.1 christos usual options you use. The reason we don't want C files is that we
193 1.1 christos might not have a C compiler around for the target you use. While it
194 1.1 christos might be possible to build a compiler, that takes considerable time and
195 1.1 christos disk space, and we might not end up with exactly the same compiler you
196 1.1 christos use.
197 1.1 christos
198 1.1 christos In the case of a ld problem, the input files are .o, .a and .so files,
199 1.1 christos and possibly a linker script specified with -T. Again, when using gcc
200 1.1 christos to link, you can see these files by adding options to the gcc command
201 1.1 christos line. Use -v -save-temps -Wl,-t, except that on targets that use gcc's
202 1.1 christos collect2, you would add -v -save-temps -Wl,-t,-debug. The -t option
203 1.1 christos tells ld to print all files and libraries used, so that, for example,
204 1.1 christos you can associate -lc on the ld command line with the actual libc used.
205 1.1 christos Note that your simple two line C program to trigger a problem typically
206 1.1 christos expands into several megabytes of objects by the time you include
207 1.1 christos libraries.
208 1.1 christos
209 1.8 christos There is a limit to the size of attachments accepted by bugzilla. If
210 1.8 christos compressing your testcase does not result in an acceptable size tar or
211 1.8 christos zip file, please put large testcases somewhere on an ftp or web site.
212 1.8 christos Better still, try to reduce the testcase, for example, try to develop
213 1.8 christos a ld testcase that doesn't use system libraries. However, please be
214 1.8 christos sure it is a complete testcase and that it really does demonstrate the
215 1.8 christos problem. Also, don't bother paring it down if that will cause large
216 1.8 christos delays in filing the bug report.
217 1.1 christos
218 1.1 christos If you expect to be contributing a large number of test cases, it would
219 1.1 christos be helpful if you would look at the test suite included in the release
220 1.1 christos (based on the Deja Gnu testing framework, available from the usual ftp
221 1.1 christos sites) and write test cases to fit into that framework. This is
222 1.1 christos certainly not required.
223 1.1 christos
224 1.1 christos VMS
225 1.1 christos ===
226 1.1 christos
227 1.1 christos This section was written by Klaus K"ampf <kkaempf (a] rmi.de>. It
228 1.1 christos describes how to build and install the binutils on openVMS (Alpha and
229 1.1 christos Vax). (The BFD library only supports reading Vax object files.)
230 1.1 christos
231 1.1 christos Compiling the release:
232 1.1 christos
233 1.1 christos To compile the gnu binary utilities and the gnu assembler, you'll
234 1.1 christos need DEC C or GNU C for openVMS/Alpha. You'll need *both* compilers
235 1.1 christos on openVMS/Vax.
236 1.1 christos
237 1.1 christos Compiling with either DEC C or GNU C works on openVMS/Alpha only. Some
238 1.1 christos of the opcodes and binutils files trap a bug in the DEC C optimizer,
239 1.1 christos so these files must be compiled with /noopt.
240 1.1 christos
241 1.1 christos Compiling on openVMS/Vax is a bit complicated, as the bfd library traps
242 1.1 christos a bug in GNU C and the gnu assembler a bug in (my version of) DEC C.
243 1.1 christos
244 1.1 christos I never tried compiling with VAX C.
245 1.1 christos
246 1.1 christos
247 1.1 christos You further need GNU Make Version 3.76 or later. This is available
248 1.1 christos at ftp.progis.de or any GNU archive site. The makefiles assume that
249 1.1 christos gmake starts gnu make as a foreign command.
250 1.1 christos
251 1.1 christos If you're compiling with DEC C or VAX C, you must run
252 1.1 christos
253 1.1 christos $ @setup
254 1.1 christos
255 1.1 christos before starting gnu-make. This isn't needed with GNU C.
256 1.1 christos
257 1.1 christos On the Alpha you can choose the compiler by editing the toplevel
258 1.1 christos makefile.vms. Either select CC=cc (for DEC C) or CC=gcc (for GNU C)
259 1.1 christos
260 1.1 christos
261 1.1 christos Installing the release
262 1.1 christos
263 1.1 christos Provided that your directory setup conforms to the GNU on openVMS
264 1.1 christos standard, you already have a concealed device named 'GNU_ROOT'.
265 1.1 christos In this case, a simple
266 1.1 christos
267 1.1 christos $ gmake install
268 1.1 christos
269 1.1 christos suffices to copy all programs and libraries to the proper directories.
270 1.1 christos
271 1.1 christos Define the programs as foreign commands by adding these lines to your
272 1.1 christos login.com:
273 1.1 christos
274 1.1 christos $ gas :== $GNU_ROOT:[bin]as.exe
275 1.1 christos $ size :== $GNU_ROOT:[bin]size.exe
276 1.1 christos $ nm :== $GNU_ROOT:[bin]nm.exe
277 1.1 christos $ objdump :== $GNU_ROOT:[bin]objdump.exe
278 1.1 christos $ strings :== $GNU_ROOT:[bin]strings.exe
279 1.1 christos
280 1.1 christos If you have a different directory setup, copy the binary utilities
281 1.1 christos ([.binutils]size.exe, [.binutils]nm.exe, [.binutils]objdump.exe,
282 1.1 christos and [.binutils]strings.exe) and the gnu assembler and preprocessor
283 1.1 christos ([.gas]as.exe and [.gas]gasp.exe]) to a directory of your choice
284 1.1 christos and define all programs as foreign commands.
285 1.1 christos
286 1.1 christos
287 1.1 christos If you're satisfied with the compilation, you may want to remove
288 1.1 christos unneeded objects and libraries:
289 1.1 christos
290 1.1 christos $ gmake clean
291 1.1 christos
292 1.1 christos
293 1.1 christos If you have any problems or questions about the binutils on VMS, feel
294 1.1 christos free to mail me at kkaempf (a] rmi.de.
295 1.3 christos
297 1.3 christos Copyright (C) 2012-2022 Free Software Foundation, Inc.
298 1.3 christos
299 1.3 christos Copying and distribution of this file, with or without modification,
300 1.3 christos are permitted in any medium without royalty provided the copyright
301 notice and this notice are preserved.
302