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