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