1c074d1c9Sdrahn README for BINUTILS 2c074d1c9Sdrahn 3b305b0f1SespieThese are the GNU binutils. These are utilities of use when dealing 4c074d1c9Sdrahnwith binary files, either object files or executables. These tools 5c074d1c9Sdrahnconsist of the linker (ld), the assembler (gas), and the profiler 6c074d1c9Sdrahn(gprof) each of which have their own sub-directory named after them. 7c074d1c9SdrahnThere is also a collection of other binary tools, including the 8c074d1c9Sdrahndisassembler (objdump) in this directory. These tools make use of a 9c074d1c9Sdrahnpair of libraries (bfd and opcodes) and a common set of header files 10c074d1c9Sdrahn(include). 112159047fSniklas 12c074d1c9SdrahnThere are README and NEWS files in most of the program sub-directories 13c074d1c9Sdrahnwhich give more information about those specific programs. 142159047fSniklas 152159047fSniklas 162159047fSniklasUnpacking and Installation -- quick overview 17b305b0f1Sespie============================================ 182159047fSniklas 19c074d1c9SdrahnWhen you unpack the binutils archive file, you will get a directory 20c074d1c9Sdrahncalled something like `binutils-XXX', where XXX is the number of the 21c074d1c9Sdrahnrelease. (Probably 2.13 or higher). This directory contains 22c074d1c9Sdrahnvarious files and sub-directories. Most of the files in the top 23c074d1c9Sdrahndirectory are for information and for configuration. The actual 24c074d1c9Sdrahnsource code is in sub-directories. 252159047fSniklas 262159047fSniklasTo build binutils, you can just do: 272159047fSniklas 28c074d1c9Sdrahn cd binutils-XXX 29b305b0f1Sespie ./configure [options] 302159047fSniklas make 312159047fSniklas make install # copies the programs files into /usr/local/bin 322159047fSniklas # by default. 332159047fSniklas 34b305b0f1SespieThis will configure and build all the libraries as well as the 35b305b0f1Sespieassembler, the binutils, and the linker. 362159047fSniklas 37b305b0f1SespieIf you have GNU make, we recommend building in a different directory: 38b305b0f1Sespie 39b305b0f1Sespie mkdir objdir 40b305b0f1Sespie cd objdir 41c074d1c9Sdrahn ../binutils-XXX/configure [options] 42b305b0f1Sespie make 43b305b0f1Sespie make install 44b305b0f1Sespie 45b305b0f1SespieThis relies on the VPATH feature of GNU make. 46b305b0f1Sespie 47b305b0f1SespieBy default, the binutils will be configured to support the system on 48b305b0f1Sespiewhich they are built. When doing cross development, use the --target 49c074d1c9Sdrahnconfigure option to specify a different target, eg: 50c074d1c9Sdrahn 51c074d1c9Sdrahn ./configure --target=foo-elf 52b305b0f1Sespie 53b305b0f1SespieThe --enable-targets option adds support for more binary file formats 54b305b0f1Sespiebesides the default. List them as the argument to --enable-targets, 55b305b0f1Sespieseparated by commas. For example: 562159047fSniklas 572159047fSniklas ./configure --enable-targets=sun3,rs6000-aix,decstation 582159047fSniklas 59c074d1c9SdrahnThe name 'all' compiles in support for all valid BFD targets: 602159047fSniklas 612159047fSniklas ./configure --enable-targets=all 622159047fSniklas 63c074d1c9SdrahnOn 32-bit hosts though, this support will be restricted to 32-bit 64c074d1c9Sdrahntarget unless the --enable-64-bit-bfd option is also used: 65c074d1c9Sdrahn 66c074d1c9Sdrahn ./configure --enable-64-bit-bfd --enable-targets=all 67c074d1c9Sdrahn 68c88b1d6cSniklasYou can also specify the --enable-shared option when you run 69c88b1d6cSniklasconfigure. This will build the BFD and opcodes libraries as shared 70b305b0f1Sespielibraries. You can use arguments with the --enable-shared option to 71b305b0f1Sespieindicate that only certain libraries should be built shared; for 72b305b0f1Sespieexample, --enable-shared=bfd. The only potential shared libraries in 73b305b0f1Sespiea binutils release are bfd and opcodes. 74c88b1d6cSniklas 75c88b1d6cSniklasThe binutils will be linked against the shared libraries. The build 76c074d1c9Sdrahnstep will attempt to place the correct library in the run-time search 77c88b1d6cSniklaspath for the binaries. However, in some cases, after you install the 78c88b1d6cSniklasbinaries, you may have to set an environment variable, normally 79c88b1d6cSniklasLD_LIBRARY_PATH, so that the system can find the installed libbfd 80c88b1d6cSniklasshared library. 81c88b1d6cSniklas 82b305b0f1SespieTo build under openVMS/AXP, see the file makefile.vms in the top level 830c6d0228Sniklasdirectory. 840c6d0228Sniklas 85c074d1c9Sdrahn 86c074d1c9SdrahnNative Language Support 87c074d1c9Sdrahn======================= 88c074d1c9Sdrahn 89c074d1c9SdrahnBy default Native Language Support will be enabled for binutils. On 90c074d1c9Sdrahnsome systems however this support is not present and can lead to error 91c074d1c9Sdrahnmessages such as "undefined reference to `libintl_gettext'" when 92c074d1c9Sdrahnbuilding there tools. If that happens the NLS support can be disabled 93c074d1c9Sdrahnby adding the --disable-nls switch to the configure line like this: 94c074d1c9Sdrahn 95c074d1c9Sdrahn ../binutils-XXX/configure --disable-nls 96c074d1c9Sdrahn 97c074d1c9Sdrahn 98c88b1d6cSniklasIf you don't have ar 99c88b1d6cSniklas==================== 100c88b1d6cSniklas 101c074d1c9SdrahnIf your system does not already have an 'ar' program, the normal 102c88b1d6cSniklasbinutils build process will not work. In this case, run configure as 103c88b1d6cSniklasusual. Before running make, run this script: 104c88b1d6cSniklas 105c88b1d6cSniklas#!/bin/sh 106b305b0f1SespieMAKE_PROG="${MAKE-make}" 107b305b0f1SespieMAKE="${MAKE_PROG} AR=true LINK=true" 108b305b0f1Sespieexport MAKE 109b305b0f1Sespie${MAKE} $* all-libiberty 110b305b0f1Sespie${MAKE} $* all-intl 111b305b0f1Sespie${MAKE} $* all-bfd 112c88b1d6cSniklascd binutils 113b305b0f1SespieMAKE="${MAKE_PROG}" 114b305b0f1Sespieexport MAKE 115c074d1c9Sdrahn${MAKE} $* ar_DEPENDENCIES= ar_LDADD='../bfd/*.o ../libiberty/*.o `if test -f ../intl/gettext.o; then echo '../intl/*.o'; fi`' ar 116c88b1d6cSniklas 117c88b1d6cSniklasThis script will build an ar program in binutils/ar. Move binutils/ar 118c88b1d6cSniklasinto a directory on your PATH. After doing this, you can run make as 119c88b1d6cSniklasusual to build the complete binutils distribution. You do not need 120c88b1d6cSniklasthe ranlib program in order to build the distribution. 121c88b1d6cSniklas 1222159047fSniklasPorting 1232159047fSniklas======= 124b305b0f1Sespie 125c074d1c9SdrahnBinutils-2.13 supports many different architectures, but there 1262159047fSniklasare many more not supported, including some that were supported 127c074d1c9Sdrahnby earlier versions. We are hoping for volunteers to improve this 128c074d1c9Sdrahnsituation. 1292159047fSniklas 1302159047fSniklasThe major effort in porting binutils to a new host and/or target 1312159047fSniklasarchitecture involves the BFD library. There is some documentation 1322159047fSniklasin ../bfd/doc. The file ../gdb/doc/gdbint.texinfo (distributed 133c074d1c9Sdrahnwith gdb-5.x) may also be of help. 1342159047fSniklas 1352159047fSniklasReporting bugs 1362159047fSniklas============== 137b305b0f1Sespie 138c074d1c9SdrahnSend bug reports and patches to: 139c074d1c9Sdrahn 140c074d1c9Sdrahn bug-binutils@gnu.org. 141c074d1c9Sdrahn 142*007c2a45SmiodPlease include the following in bug reports: 143*007c2a45Smiod 144*007c2a45Smiod- A description of exactly what went wrong, and exactly what should have 145*007c2a45Smiod happened instead. 146*007c2a45Smiod 147*007c2a45Smiod- The configuration name(s) given to the "configure" script. The 148*007c2a45Smiod "config.status" file should have this information. This is assuming 149*007c2a45Smiod you built binutils yourself. If you didn't build binutils youself, 150*007c2a45Smiod then we need information regarding your machine and operating system, 151*007c2a45Smiod and it may be more appropriate to report bugs to wherever you obtained 152*007c2a45Smiod binutils. 153*007c2a45Smiod 154*007c2a45Smiod- The options given to the tool (gas, objcopy, ld etc.) at run time. 155*007c2a45Smiod 156*007c2a45Smiod- The actual input file that caused the problem. 157*007c2a45Smiod 158c074d1c9SdrahnAlways mention the version number you are running; this is printed by 159c074d1c9Sdrahnrunning any of the binutils with the --version option. We appreciate 160*007c2a45Smiodreports about bugs, but we do not promise to fix them, particularly so 161*007c2a45Smiodwhen the bug report is against an old version. If you are able, please 162*007c2a45Smiodconsider building the latest tools from CVS to check that your bug has 163*007c2a45Smiodnot already been fixed. 164*007c2a45Smiod 165*007c2a45SmiodWhen reporting problems about gas and ld, it's useful to provide a 166*007c2a45Smiodtestcase that triggers the problem. In the case of a gas problem, we 167*007c2a45Smiodwant input files to gas and command line switches used. The inputs to 168*007c2a45Smiodgas are _NOT_ .c or .i files, but rather .s files. If your original 169*007c2a45Smiodsource was a C program, you can generate the .s file and see the command 170*007c2a45Smiodline options by passing -v -save-temps to gcc in addition to all the 171*007c2a45Smiodusual options you use. The reason we don't want C files is that we 172*007c2a45Smiodmight not have a C compiler around for the target you use. While it 173*007c2a45Smiodmight be possible to build a compiler, that takes considerable time and 174*007c2a45Smioddisk space, and we might not end up with exactly the same compiler you 175*007c2a45Smioduse. 176*007c2a45Smiod 177*007c2a45SmiodIn the case of a ld problem, the input files are .o, .a and .so files, 178*007c2a45Smiodand possibly a linker script specified with -T. Again, when using gcc 179*007c2a45Smiodto link, you can see these files by adding options to the gcc command 180*007c2a45Smiodline. Use -v -save-temps -Wl,-t, except that on targets that use gcc's 181*007c2a45Smiodcollect2, you would add -v -save-temps -Wl,-t,-debug. The -t option 182*007c2a45Smiodtells ld to print all files and libraries used, so that, for example, 183*007c2a45Smiodyou can associate -lc on the ld command line with the actual libc used. 184*007c2a45SmiodNote that your simple two line C program to trigger a problem typically 185*007c2a45Smiodexpands into several megabytes of objects by the time you include 186*007c2a45Smiodlibraries. 187*007c2a45Smiod 188*007c2a45SmiodIt is antisocial to post megabyte sized attachments to mailing lists, so 189*007c2a45Smiodplease put large testcases somewhere on an ftp or web site so that only 190*007c2a45Smiodinterested developers need to download them, or offer to email them on 191*007c2a45Smiodrequest. Better still, try to reduce the testcase, for example, try to 192*007c2a45Smioddevelop a ld testcase that doesn't use system libraries. However, 193*007c2a45Smiodplease be sure it is a complete testcase and that it really does 194*007c2a45Smioddemonstrate the problem. Also, don't bother paring it down if that will 195*007c2a45Smiodcause large delays in filing the bug report. 196*007c2a45Smiod 197*007c2a45SmiodIf you expect to be contributing a large number of test cases, it would 198*007c2a45Smiodbe helpful if you would look at the test suite included in the release 199*007c2a45Smiod(based on the Deja Gnu testing framework, available from the usual ftp 200*007c2a45Smiodsites) and write test cases to fit into that framework. This is 201*007c2a45Smiodcertainly not required. 202b305b0f1Sespie 203b305b0f1SespieVMS 204b305b0f1Sespie=== 205b305b0f1Sespie 206b305b0f1SespieThis section was written by Klaus K"ampf <kkaempf@rmi.de>. It 207b305b0f1Sespiedescribes how to build and install the binutils on openVMS (Alpha and 208b305b0f1SespieVax). (The BFD library only supports reading Vax object files.) 209b305b0f1Sespie 210b305b0f1SespieCompiling the release: 211b305b0f1Sespie 212b305b0f1SespieTo compile the gnu binary utilities and the gnu assembler, you'll 213b305b0f1Sespieneed DEC C or GNU C for openVMS/Alpha. You'll need *both* compilers 214b305b0f1Sespieon openVMS/Vax. 215b305b0f1Sespie 216b305b0f1SespieCompiling with either DEC C or GNU C works on openVMS/Alpha only. Some 217b305b0f1Sespieof the opcodes and binutils files trap a bug in the DEC C optimizer, 218b305b0f1Sespieso these files must be compiled with /noopt. 219b305b0f1Sespie 220b305b0f1SespieCompiling on openVMS/Vax is a bit complicated, as the bfd library traps 221b305b0f1Sespiea bug in GNU C and the gnu assembler a bug in (my version of) DEC C. 222b305b0f1Sespie 223b305b0f1SespieI never tried compiling with VAX C. 224b305b0f1Sespie 225b305b0f1Sespie 226b305b0f1SespieYou further need GNU Make Version 3.76 or later. This is available 227b305b0f1Sespieat ftp.progis.de or any GNU archive site. The makefiles assume that 228b305b0f1Sespiegmake starts gnu make as a foreign command. 229b305b0f1Sespie 230b305b0f1SespieIf you're compiling with DEC C or VAX C, you must run 231b305b0f1Sespie 232b305b0f1Sespie $ @setup 233b305b0f1Sespie 234b305b0f1Sespiebefore starting gnu-make. This isn't needed with GNU C. 235b305b0f1Sespie 236b305b0f1SespieOn the Alpha you can choose the compiler by editing the toplevel 237b305b0f1Sespiemakefile.vms. Either select CC=cc (for DEC C) or CC=gcc (for GNU C) 238b305b0f1Sespie 239b305b0f1Sespie 240b305b0f1SespieInstalling the release 241b305b0f1Sespie 242b305b0f1SespieProvided that your directory setup conforms to the GNU on openVMS 243c074d1c9Sdrahnstandard, you already have a concealed device named 'GNU_ROOT'. 244b305b0f1SespieIn this case, a simple 245b305b0f1Sespie 246b305b0f1Sespie $ gmake install 247b305b0f1Sespie 248b305b0f1Sespiesuffices to copy all programs and libraries to the proper directories. 249b305b0f1Sespie 250b305b0f1SespieDefine the programs as foreign commands by adding these lines to your 251b305b0f1Sespielogin.com: 252b305b0f1Sespie 253b305b0f1Sespie $ gas :== $GNU_ROOT:[bin]as.exe 254b305b0f1Sespie $ size :== $GNU_ROOT:[bin]size.exe 255b305b0f1Sespie $ nm :== $GNU_ROOT:[bin]nm.exe 256b305b0f1Sespie $ objdump :== $GNU_ROOT:[bin]objdump.exe 257b305b0f1Sespie $ strings :== $GNU_ROOT:[bin]strings.exe 258b305b0f1Sespie 259b305b0f1SespieIf you have a different directory setup, copy the binary utilities 260b305b0f1Sespie([.binutils]size.exe, [.binutils]nm.exe, [.binutils]objdump.exe, 261b305b0f1Sespieand [.binutils]strings.exe) and the gnu assembler and preprocessor 262b305b0f1Sespie([.gas]as.exe and [.gas]gasp.exe]) to a directory of your choice 263b305b0f1Sespieand define all programs as foreign commands. 264b305b0f1Sespie 265b305b0f1Sespie 266c074d1c9SdrahnIf you're satisfied with the compilation, you may want to remove 267b305b0f1Sespieunneeded objects and libraries: 268b305b0f1Sespie 269b305b0f1Sespie $ gmake clean 270b305b0f1Sespie 271b305b0f1Sespie 272b305b0f1SespieIf you have any problems or questions about the binutils on VMS, feel 273b305b0f1Sespiefree to mail me at kkaempf@rmi.de. 274