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