README 11 KB

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