The Linux ELF HOWTO version 0.99 - Tue Dec 27 by Riccardo Facchetti ** Note: This file is provided 'as-is', see disclaimer ** Note1: The Author is Riccardo Facchetti ** Note2: Read CAREFULLY all the HOWTO if you want to do the things described! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ** Note3: GNU Make v. 3.72.1 seems to have a bug, I use GNU Make v. 3.70 ** Note4: If you will install g++, you may want to install libg++ too. The installation of libg++ is NOT discussed here because it is out of the scope of this HOWTO (may be it will be included in a following release) INDEX 0. Why ? 1. Introduction 1.1 Copyright 1.2 Feedback 1.3 Disclaimer 2. What do i need to start up ? 2.1 Where can i find all the things at 2. ? 2.2 Other requirements 3. Theory of operation 3.1 Choose an alternate directory tree 4. Building binutils-2.5.2.6 4.1 Preparing binutils-2.5.2.6 for compilation 4.2 Compiling binutils-2.5.2.6 4.3 Installing binutils-2.5.2.6 5. Building gcc-2.6.2 5.1 Preparing gcc-2.6.2 for compilation 5.2 Compiling gcc-2.6.2 5.3 Installing gcc-2.6.2 5.4 Try it now! 6. Building libc-4.6.27 6.1 Preparing libc-4.6.27 for compilation 6.2 Compiling libc-4.6.27 6.3 Installing libc-4.6.27 6.4 Try the Whole Thing! 7. Recompiling the Whole Thing: Stage 2 7.1 Recompiling binutils-2.5.2.6 7.2 Recompiling gcc-2.6.2 7.3 Recompiling libc-4.6.27 8. Patch: binutils-2.5.2 ==> binutils-2.5.2.6 ============================================================================== 0. Why ? Hello, in the last two weeks, i've faced the problem of jump-table -> ELF migration This is a real problem because linux binary format is destined to migrate to ELF and sooner or later we will be forced to re-install all the binaries or re-compile it (unless we want have systems in an half-way with both ELF and jump-table libraries for long time) I've started to ask around where can i find ELF gcc/gas/gld/libc ELF binaries. Unfortunately noone have answered to me useful informations. After this first try, i've decided to bootstrap an ELF development package on my onw. I have collected all the stages in an HOW TO: the ELF-HOWTO. 1. Introduction This is the Linux ELF HOWTO. This document describes the way I have started the migration of my system to the ELF binary file format. This HOWTO is written during the Real Thing: all the things written here are tested by me directly. 1.1 Copyright The Linux ELF HOWTO is copyright (C) 1995 by Riccardo Facchetti. Linux HOWTO documents may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions. All translations, derivative works, or aggregate works incorporating any Linux HOWTO documents must be covered under this copyright notice. That is, you may not produce a derivative work from a HOWTO and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at the address given below. In short, we wish to promote dissemination of this information through as many channels as possible. However, we do wish to retain copyright on the HOWTO documents, and would like to be notified of any plans to redistribute the HOWTOs. If you have questions, please contact Matt Welsh, the Linux HOWTO coordinator, at mdw@sunsite.unc.edu. You may finger this address for phone number and additional contact information. 1.2 Feedback Since this HOWTO will be mantained in a relaxed way because of the little time I can spend on it, please send me suggestions, bugs and comments, but don't expect them to be included in a short-term update. You can reach me via e-mail at: riccardo@cdc8g5.cdc.polimi.it or via snail-mail at: Riccardo Facchetti Via PAOLO VI, 29 22053 - Lecco (Lc) ITALY 1.3 Disclaimer This document is *not* bible. The Author is not responsible for any damages incurred due to actions taken based on the information included in this document. 2. What do i need to start up ? To build ELF executables you need an ELF C compiler, an ELF assembler, an ELF linker, and ELF C libraries (static/dynamic/debug/profile). These are the sources you need to build the ELF system: if you change ^^^^^^^^^^^^^ some source (e.g. you would like to use gcc-2.6.3 instead of gcc-2.6.2) ^^^^^^^^^^^ you are on your own. I think you should follow this document anyway because the things contained here are generalized enought. If you use a binutils package newer that binutils-2.5.2 may be you do not need to patch it with the patch 2.5.2 => 2.5.2.6 If you use a newer gcc may be you can follow this HOWTO step by step If you use a newer libc, may be you do not need to edit all the files I have edited. Do not do anything without think (be sure of what you are doing)!!! ELF C compiler: gcc-2.6.2 as is ELF assembler: binutils-2.5.2 patched to 2.5.2.6 ELF linker: binutils-2.5.2 patched to 2.5.2.6 ELF C libraries: libc-4.6.27 as is C libraries header patch: binutils-2.5.2 => binutils-2.5.2.6 2.1 Where can i find all the things at 2. ? gcc-2.6.2: standard GNU distribution binutils-2.5.2: standard GNU distribution libc-4.6.27: standard linux.site:/pub/linux/GCC/libc-4.6.27.tar.gz patch binutils-2.5.2 => binutils-2.5.2.6: at the end of this document or in libc-4.6.27 announce 2.2 Other requirements You need to have the libc-4.6.27 jump-table version and inc-2.6.27 installed on your system. You can find it in every major linux site in /pub/linux/GCC/ You need to know how to edit/change/save a text file You need at least 50 Mbytes of HD space ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You need jump-table development system (gcc/gas/ld/make/includes/kernel/etc) You need to compile the BINFMT_ELF option into the kernel To build ELF development system you need the kernel 1.1.72 or above [excerpt from libc-4.6.27 announce] You need in the kernel 1.1.72 or above if you want to compile the ELF libraries yourself. Otherwise, please join the Linux gcc list. You need to recompile the libraries with the kernel 1.1.65 or above to gain the support for 57600 and 115200 bps. [end of excerpt] 3. Theory of operation The problem of building the development system for ELF binaries is that we need to bootstrap the system from jump-table system. On the other hand, we NEED to mantain separate the jump-table system from the ELF one because we may want to use all the two development systems. We also need to have a /lib for jump-table and one for ELF, a gcc/gas/ld for jump-table and one for ELF (this is our goal of course :) So we need to do the following operations: a) Choose an alternate directory tree for ELF system b) Build jump-table binaries of binutils-2.5.2.6, to have the ELF assembler (gas) and linker (ld) c) Install the b) d) Build jump-table binaries of gcc-2.6.2 to have the ELF C compiler e) Install the d) f) Build ELF binaries of libc-4.6.27, to have ELF C libraries g) Install the f) h) b)-g) is the first stage. To have gcc/gas/ld ELF binaries you must repeat the b)-g) stage (2nd stage). 3.1 Choose an alternate directory tree You must choose an alternate directory tree for your ELF system. I have chosen: /lib/elf for ELF shared libraries /usr/i486-linuxelf/... for all the ELF related files /usr/i486-linuxelf/bin for ELF binaries /usr/i486-linuxelf/lib for libraries /usr/i486-linuxelf/lib/gcc-lib/... for gcc and its files ... so the installation prefix will ever be /usr/i486-linuxelf 4. Building binutils-2.5.2.6 4.1 Preparing binutils-2.5.2.6 for compilation * Unpacking the archive cd /usr/src tar xfvz binutils-2.5.2.tar.gz cd binutils-2.5.2 * Patching binutils-2.5.2 to binutils-2.5.2.6 patch -p0 < ELF-HOWTO where ELF-HOWTO is this file. The patch, made by H.J. Lu, fixes some binutils-2.5.2 bugs and allow the support for ELF. * Search for rejected patches find . -name *.rej -print should find nothing * Search and erase the original files find . -name *.orig -print -exec rm -f {} \; * Edit bfd/elf32-i386.c vi bfd/elf32-i386.c at line 194 you should find: #define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1" change it to: #define ELF_DYNAMIC_INTERPRETER "/lib/elf/ld-linux.so.1" The libc-4.6.27 will put the dinamic linker in /lib/elf and ld-linux.so.1 will be a symlink to the real linker -> /lib/elf/ld-linux.so.1.0.14 This is needed because the ELF executables will use this run-time linker to link the shared libraries. * Configure the binutils-2.5.2.6 If you have an i386: ./configure i386-linuxelf for a 486: ./configure i486-linuxelf have a little break during configuration, it take few minutes. * Edit Makefile vi Makefile at line 36 you should find: prefix = /usr/local change it to: prefix = /usr/i486-linuxelf to reflect the installation directory tree we have chosen. at line 82 you should find: CFLAGS = -g change it to: CFLAGS = -O2 -m486 -fomit-frame-pointer (use the -m486 only if you have an i486) for optimization. * Edit ld/Makefile to change the defaule emulation mode: vi ld/Makefile at line 189 you should find: EMUL=i386linux EMUL_EXTRA1=elf_i386 swap it to: EMUL_EXTRA1=i386linux EMUL=elf_i386 to set the default emulation to elf_i386 (this will be the ELF linker, not the jump-table one). 4.2 Compiling binutils-2.5.2.6 do the make and have a long coffee break. 4.3 Installing binutils-2.5.2.6 do the make install and it is done. Now if you are short of disk space you may want to cd /usr/src rm -rf binutils-2.5.2 5. Building gcc-2.6.2 Now we have in /usr/i486-linuxelf/bin the as (gas) and ld (gld), both compiled for ELF support. Now we will compile gcc-2.6.2 to generate ELF code. We need ELF assembler because in the final step, when make generate the libgcc using the xgcc, the xgcc is an ELF compiler so he (it?) need the ELF assembler. Note: gcc-2.6.2 seems to have a bug in ELF generation code of the profiler section. When you build code to be profiled (-p or -pg), gcc-2.6.2 generates a call to mcount() function. Unfortunately, this code is generated in assembly stage and gcc fails to generate it. In fact generates: call _mcount instead of call mcount ELF binary format do not prepend the '_' (underscore) when compiling C to asm functions (don't know for sure, but it is likely to be true), so you will end up with a lot of undefined reference to `_mcount' messages. I do not use the profiler. Anyway i think the best way to correct this bug is modify libgcc because i have not the stomach to put my hands on the gcc :) (see 6.1) 5.1 Preparing gcc-2.6.2 for compilation * Unpacking the archive cd /usr/src tar xfvz gcc-2.6.2.tar.gz cd gcc-2.6.2 * If you are short of disk space (now you need 30 Mbytes to compile gcc) If you are running short of disk space, you may need to erase some unneeded documentation: rm -f ChangeLog* rm -f gcc.info* rm -f cpp.info* rm -f texinfo.tex gcc.ps * Configure the gcc-2.6.2 If you have an i386: ./configure --with-elf i386-linux for a 486: ./configure --with-elf i486-linux * Edit Makefile vi Makefile at line 154 you should find: prefix = /usr/local change it to: prefix = /usr/i486-linuxelf at line 159 you should find: local_prefix = /usr/local change it to: local_prefix = /usr/i486-linuxelf to reflect the installation path we have chosen. * Configuring gcc package to use the ELF assembler/linker in libgcc2.a compilation ln -s /usr/i486-linuxelf/bin/as . ln -s /usr/i486-linuxelf/bin/ld . with this two links, we enable the xgcc (the gcc just compiled) to make use of the ELF assembler/linker. 5.2 Compiling gcc-2.6.2 do make LANGUAGES=c CC=gcc CFLAGS="-O2 -m486 -fomit-frame-pointer -N" Note: change the CFLAGS as needed (for example i have compiled gcc with -O3 maximum optimization flag set). Note1: enquire.c will not compile because we do not still have a C library. Note3: it is not important the optimization flag because this is only the first stage of compilation. In the near future we will re-compile the gcc. (see 7.) Note4: you should read the INSTALL file of gcc Now have a long tea-time break with a friend (better if of the opposite sex) talking about something of interesting ;) 5.3 Installing gcc-2.6.2 * Install the binaries do make install LANGUAGES=c * Link the cpp to the ELF installation We need to link it because /usr/i486-linuxelf/bin is not in our search PATH ln -s /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/cpp /usr/i486-linuxelf/bin * Copy float.h from your gcc jump-table installation to the ELF one enquire could not be compiled, so float.h is a zero lenght file, but we can get it from the jump-table installation of gcc: cp /usr/lib/gcc-lib/i486-linux/2.6.2/include/float.h /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/include/ * Build some shell scripts to use the gcc-elf in a smoother way vi /usr/bin/gcc-elf [start] #! /bin/sh /usr/i486-linuxelf/bin/gcc -L/usr/i486-linuxelf/lib -B/usr/i486-linuxelf/bin/ $* [end] vi /usr/bin/as-elf [start] #! /bin/sh /usr/i486-linuxelf/bin/as $* [end] vi /usr/bin/ld-elf [start] #!/bin/sh /usr/i486-linuxelf/bin/ld $* [end] chmod 755 /usr/bin/*-elf * Set up the compiler specs to run with ELF enviroenment cd /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2 vi specs in the section *startfile (startup code), at line 26 you should find: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static} change it to: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}} %{!never:crti.o%s crtn.o%s} %{static:-static} Note: this change tells the compiler to link the crt1+crti+crtn that are the startup code of ELF executables. When gcc-elf is invoked with -pg or -p option, it links gcrt1.o instead of crt1.o The format of %{a:b} statements is: if (a is true) { do b; } Note1: b can be another %{a:b} statement in section *predefines (always 'defined' by gcc), at line 35 you should find -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) change it to: -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) Note2: you MUST define the -D__ELF__ because THIS gcc (gcc-elf) is an ELF compiler so we need to use the ELF specific code contained in /usr/include/... files and it is done. Now if you are short of disk space you may want to cd /usr/src rm -rf gcc-2.6.2 5.4 Try it now! Just to be sure all the things are okay until now: check your gcc installation with 'gcc-elf -v', then try to compile something: cd /tmp edit a file called p.c vi p.c [start] main() { printf("prova\n"); } [end] 'prova' means just 'test' in italian language :) then compile it to the object file (only to object because we still have not the C library) gcc-elf -v -c p.c You should be able to see that gcc-elf invoke all the /usr/i486-linuxelf stuff. Now to check the kind of file gcc-elf have built, do file p.o and it should say that p.o is an ELF 32-bit LSB relocatable i386 (386 and up) Version 1 Of course you must have the ELF definition in /etc/magic file. If gcc-elf builds ELF objects, we are on the right way! 6. Building libc-4.6.27 Now we have the ELF compiler/assembler/linker. We need an ELF C library. This step will build the libc-4.6.27 in static/shared/debug/profile versions. 6.1 Preparing libc-4.6.27 for compilation * Unpacking the archive cd /usr/src tar xfvz libc-4.6.27.tar.gz cd libc-linux * Configuring the libc-4.6.27 ./configure Values correct (y/n) [y] ? n Build 386, 486 or m68k library code (486 default) 4/3/m [4] ? The target platform [i486-linux] ? The target OS [linux] ? Build targets (static/shared default) s/a [a] ? Root path to i486-linux related files [/usr] ? Bin path to gcc [/usr/bin] ? The gcc version [2.6.2] ? Fast build/save space (fast default) f/s [f] ? GNU `make' executable [make] ? Root path to installation dirs [/] ? Build a NYS libc from nys* (y default) y/n [n] ? Values correct (y/n) [y] ? Note: all the above configuration parameters are defaults but you MUST do the ./configure to reset the config.in * Edit Makeconfig vi Makeconfig at line 368 you should find: PIC_OPT_CFLAGS= -fPIC -O1 -funroll-loops -fomit-frame-pointer change it to: PIC_OPT_CFLAGS= -fPIC -D__PIC__ -O1 -funroll-loops -fomit-frame-pointer we need to define __PIC__ because the syscall?() macros are different for PIC and !PIC code. at line 327 you should find: REALCC =gcc-elf -V $(GCCVERSION) -b $(TARGET_MACHINE) \ change it to: REALCC =gcc-elf \ we do not need the -V -b switches because gcc-elf should use the right binaries and -V -b confuses the compiler. * Edit elf/Makefile vi elf/Makefile at line 29 you can find: if [ "1" = "1" ]; then \ change it to: if [ "0" = "1" ]; then \ to make use of the linker directly and not through gcc-elf, because sadly gcc-elf do not support the -shared switch. * Edit elf/d-link/libdl/Makefile vi elf/d-link/libdl/Makefile at line 29 you should find: ELF_LDFLAGS=--shared -nostdlib # using GNU ld change it to: ELF_LDFLAGS=-Wl,-shared -nostdlib # using GNU ld to pass the -shared switch directly to the linker, see above. * Edit elf/d-link/readelflib1.c This is important because the ld-linux.so (ELF shlib loader) must know that the standard ELF shlib path is /lib/elf/ and not /lib/ At line 122 you should find: pnt1 = "/lib/"; change it to: pnt1 = "/lib/elf/"; * Edit sysdeps/linux/i386/gmon/gmon.c This change is needed if you want to use the profile option with gcc-2.6.2 (see the Note at 5.) Note1: if you upgrade the gcc (say to gcc-2.6.3) you have to check if this new gcc is able to handle ELF profiling code. You can do it this way: vi p.c [start] main() { printf("Prova\n"); } [end] Now compile it this way: gcc-elf -p -S p.c gcc generate a p.s (assembly) * Edit p.s vi p.s at some time in the assembly listing you should find: call _mcount or call mcount in the first case your gcc is buggy so you should apply the next patch to gmon.c, in the second case, gcc is okay so don't apply the next patch at line 50 you should find: extern void mcount(); /* asm ("mcount"); */ change it to: extern void _mcount(); /* asm ("_mcount"); */ at line 221 you should find: mcount() change it to: _mcount() 6.2 Compiling libc-4.6.27 Now it is time to compile the libc-4.6.27. My suggestion is to launch the compilation and then go to sleep or something like that because it takes LOT of time ( and if you have better things to do other than sleep, your time is not lost doing such nice things :) do nohup make ELF=true & (for those who use the zsh now they should do a 'disown %1') now you can logout/exit/ctrl-d Note: the nohup is important because it log all the compilation in a file called nohup.out At the end of compilation, before going to the next step, you must check the nohup.out (~ 1.5 Mbytes) for errors. Do grep Error nohup.out it should print out nothing. If any error is encountered, investigate and try to correct it. 6.3 Installing libc-4.6.27 To install the ELF libraries do make install.elf and it is done! Now you can delete the libc-linux cd /usr/src rm -rf libc-linux 6.4 Try the Whole Thing! cd /tmp edit a file called p.c vi p.c [start] main() { printf("prova\n"); } [end] now try to compile the file to use the shared ELF library: gcc-elf -O -v p.c -o p 'file p' should say: p: ELF 32-bit LSB executable i386 (386 and up) Version 1 run './p' and you should see the output 'prova' repeat the above operations to check the static/debug/profile with these command lines: gcc-elf -static -O -v p.c -o p gcc-elf -g -v p.c -o p gcc-elf -p -v p.c -o p gcc-elf -pg -v p.c -o p launch the './p' for every compilation to check that p is right. If you cannot see the output 'prova', you have failed something: make sure you have executed all the passes described in this HOWTO and if you find some error, please let me know. If this last test is Passed, you have succeeded installing the bootstrap ELF dev. sys. 7. Recompiling the Whole Thing: Stage 2 Now you MUST go on recompiling the Whole Thing to be sure all is okay. The recompilation is not only the way to have ELF binaries, it is a way to test the reliability of the binaries we have just compiled. Think this as the Stage 2 (a la gcc stage2). I do not think a stage3 will be useful, but if you like you can do the stage 3 too :) (e.g. Stage 3 compiled files should be the same as Stage 2, given the compilation flags) Mainly you have to repeat the 4.* 5.* 6.*, with a little difference: in the Stage 2 you will use the gcc-elf! 7.1 Recompiling binutils-2.5.2.6 Follow the 4.1 Now you must change the gcc with gcc-elf in Makefile * Edit Makefile vi Makefile at line 72 you should find: CC = cc change it to: CC = gcc-elf Now follow the 4.2 and 4.3 You are done with binutils-2.5.2.6 7.2 Recompiling gcc-2.6.2 Follow the 5.1 for configuration. Now compile the compiler stage1, do: make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N" Be warned: all the things related to enquire.c and float.h are still valid!! We have now the ELF C lib but enquire will compile and link the right way only if we copy the installed gcc-elf specs file in gcc source directory (xgcc must know where to find crt and libc), so you have wait until the gcc compilation is finished, then you will cp the correct specs: cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs . then remove enquire (an invalid file): rm ./enquire then re-compile with the same command line as the first compilation, and it will finish the compilation: do the above for all compilation stages, after every build. now make stage2 and stage3 of the compiler to build g++ and obj-c. Here the commands: *** First compilation (stage1) *** ln -s /usr/i486-linuxelf/bin/as . ln -s /usr/i486-linuxelf/bin/ld . make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N" cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs . rm ./enquire make LANGUAGES=c CC=gcc-elf CFLAGS="-O2 -m486 -fomit-frame-pointer -N" *** Second compilation (stage2) *** make stage1 ln -s /usr/i486-linuxelf/bin/as stage1/as ln -s /usr/i486-linuxelf/bin/ld stage1/ld make LANGUAGES=c CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N" cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs . rm ./enquire make LANGUAGES=c CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N" *** Third compilation (stage3) *** make stage2 ln -s /usr/i486-linuxelf/bin/as stage2/as ln -s /usr/i486-linuxelf/bin/ld stage2/ld make CC="stage2/xgcc -Bstage2/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N" cp /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs . rm ./enquire make CC="stage2/xgcc -Bstage2/" CFLAGS="-O2 -m486 -fomit-frame-pointer -N" Now compare the objects of stage2 and stage3: they MUST be equal!!!! for file in *.o do echo $file cmp $file stage2/$file done Now for installation do make install Make sure /usr/i486-linuxelf/lib/gcc-lib/i486-linux/2.6.2/specs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is correct. ^^^^^^^^^^^ 7.3 Recompiling libc-4.6.27 Follow 6.1, 6.2 and 6.3 8. Patch binutils-2.5.2 ==> binutils-2.5.2.6 Note: you can apply this patch by simply 'patch -p0 < this-file' H.J. Lu hjl@nynexst.com 12/16/94 This patch contains some necessary bug fixes for binutils 2.5.2 to support ELF. It is called 2.5.2.6 by me. The fixes may not be the same as the ones in the next public release of binutils. H.J. 12/14/94 --- *** ./binutils/Makefile.in.orig Tue Nov 29 11:03:51 1994 --- ./binutils/Makefile.in Wed Dec 14 11:42:03 1994 *************** *** 70,76 **** LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` # Distribution version ! VERSION=2.5.2 # Distribution name DIST_NAME=binutils-${VERSION} --- 70,76 ---- LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi` # Distribution version ! VERSION=2.5.2.6 # Distribution name DIST_NAME=binutils-${VERSION} *** ./config/mh-linux.orig Mon Nov 28 19:55:59 1994 --- ./config/mh-linux Mon Nov 28 19:56:07 1994 *************** *** 2,8 **** # FIXME: What is this used for? It should go away (and even if it hasn't, # it's not clear linux should define it). SYSV = -DSYSV ! RANLIB = ranlib # What is this doing here? #LDFLAGS = -static --- 2,8 ---- # FIXME: What is this used for? It should go away (and even if it hasn't, # it's not clear linux should define it). SYSV = -DSYSV ! #RANLIB = ranlib # What is this doing here? #LDFLAGS = -static *** ./bfd/config/i386linux.mh.orig Mon Nov 28 19:55:18 1994 --- ./bfd/config/i386linux.mh Mon Nov 28 19:55:27 1994 *************** *** 1,4 **** HDEFINES=-DTRAD_CORE HDEPFILES=trad-core.o # Apparently this is needed to build objdump in certain configurations. ! EXTRALIBS=-lm --- 1,4 ---- HDEFINES=-DTRAD_CORE HDEPFILES=trad-core.o # Apparently this is needed to build objdump in certain configurations. ! #EXTRALIBS=-lm *** ./bfd/bfd-in.h.orig Mon Sep 26 11:01:57 1994 --- ./bfd/bfd-in.h Fri Nov 11 14:30:17 1994 *************** *** 545,555 **** extern boolean bfd_elf64_record_link_assignment PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_elf32_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, struct bfd_link_info *, ! struct sec **)); extern boolean bfd_elf64_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, struct bfd_link_info *, ! struct sec **)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); /* SunOS shared library support routines for the linker. */ --- 545,555 ---- extern boolean bfd_elf64_record_link_assignment PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_elf32_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, boolean, ! struct bfd_link_info *, struct sec **)); extern boolean bfd_elf64_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, boolean, ! struct bfd_link_info *, struct sec **)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); /* SunOS shared library support routines for the linker. */ *** ./bfd/bfd-in2.h.orig Fri Oct 21 21:27:50 1994 --- ./bfd/bfd-in2.h Fri Nov 11 14:30:17 1994 *************** *** 545,555 **** extern boolean bfd_elf64_record_link_assignment PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_elf32_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, struct bfd_link_info *, ! struct sec **)); extern boolean bfd_elf64_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, struct bfd_link_info *, ! struct sec **)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); /* SunOS shared library support routines for the linker. */ --- 545,555 ---- extern boolean bfd_elf64_record_link_assignment PARAMS ((bfd *, struct bfd_link_info *, const char *)); extern boolean bfd_elf32_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, boolean, ! struct bfd_link_info *, struct sec **)); extern boolean bfd_elf64_size_dynamic_sections ! PARAMS ((bfd *, const char *, const char *, boolean, ! struct bfd_link_info *, struct sec **)); extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *)); /* SunOS shared library support routines for the linker. */ *** ./bfd/elfcode.h.orig Tue Nov 1 17:59:53 1994 --- ./bfd/elfcode.h Sat Dec 10 14:09:19 1994 *************** *** 1845,1851 **** --- 1845,1858 ---- if (phdr->p_type != PT_NULL && (hdr->sh_offset - (phdr->p_offset + phdr->p_memsz) == hdr->sh_addr - (phdr->p_vaddr + phdr->p_memsz)) + #if 0 + /* FIXME: ctors/dtors contain the code, but are r/w. */ + && (last_type != SHT_NOBITS || hdr->sh_type == SHT_NOBITS) + && (((hdr->sh_flags & SHF_WRITE) == 0 && (phdr->p_flags & PF_W) == 0) + || ((hdr->sh_flags & SHF_WRITE) != 0 && (phdr->p_flags & PF_W) != 0))) + #else && (last_type != SHT_NOBITS || hdr->sh_type == SHT_NOBITS)) + #endif { bfd_size_type adjust; *************** *** 3744,3749 **** --- 3751,3758 ---- PARAMS ((bfd *, struct bfd_link_info *)); static Elf_Internal_Rela *elf_link_read_relocs PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean)); + static boolean elf_export_symbol + PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_adjust_dynamic_symbol PARAMS ((struct elf_link_hash_entry *, PTR)); *************** *** 4863,4873 **** addresses of the various sections. */ boolean ! NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, info, ! sinterpptr) bfd *output_bfd; const char *soname; const char *rpath; struct bfd_link_info *info; asection **sinterpptr; { --- 4872,4883 ---- addresses of the various sections. */ boolean ! NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, ! export_dynamic, info, sinterpptr) bfd *output_bfd; const char *soname; const char *rpath; + boolean export_dynamic; struct bfd_link_info *info; asection **sinterpptr; { *************** *** 4887,4892 **** --- 4897,4908 ---- if (dynobj == NULL) return true; + /* If we are supposed to export all symbols into the dynamic symbol + table (this is not the normal case), then do so. */ + if (export_dynamic) + elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol, + (PTR) info); + if (elf_hash_table (info)->dynamic_sections_created) { *sinterpptr = bfd_get_section_by_name (dynobj, ".interp"); *************** *** 5019,5024 **** --- 5035,5064 ---- return true; } + /* This routine is used to export all defined symbols into the dynamic + symbol table. It is called via elf_link_hash_traverse. */ + + static boolean + elf_export_symbol (h, data) + struct elf_link_hash_entry *h; + PTR data; + { + struct bfd_link_info *info = (struct bfd_link_info *) data; + + if (h->dynindx == -1 + && (h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_REGULAR + | ELF_LINK_HASH_REF_REGULAR)) != 0) + { + if (! elf_link_record_dynamic_symbol (info, h)) + { + /* FIXME: No way to report error. */ + abort (); + } + } + + return true; + } + /* Make the backend pick a good value for a dynamic symbol. This is called via elf_link_hash_traverse, and also calls itself recursively. */ *************** *** 5202,5207 **** --- 5242,5248 ---- dynamic = elf_hash_table (info)->dynamic_sections_created; dynobj = elf_hash_table (info)->dynobj; + BFD_ASSERT (dynamic ? dynobj != 0 : dynobj == 0); /* FIXME */ finfo.info = info; finfo.output_bfd = abfd; *************** *** 5895,5900 **** --- 5936,5955 ---- strip = true; else strip = false; + + /* + * If we are not creating a shared library, complain about any symbols which + * are undefined. If we do not do this, the linker will not complain about + * unresolved references within shared libraries, and the application might + * die at runtime. Only warn about symbols that are referenced in shared libraries + * and not in regular .o files - the rest have been warned about already. + */ + if (!finfo->info->shared && + !(h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_REGULAR | ELF_LINK_HASH_DEF_DYNAMIC)) + && (h->elf_link_hash_flags & (ELF_LINK_HASH_REF_REGULAR | ELF_LINK_HASH_REF_DYNAMIC)) + == ELF_LINK_HASH_REF_DYNAMIC) + (*finfo->info->callbacks->undefined_symbol) + (finfo, h->root.root.string, h->root.u.undef.abfd, bfd_und_section_ptr, 0); /* If we're stripping it, and it's not a dynamic symbol, there's nothing else to do. */ *** ./bfd/elf32-i386.c.orig Fri Nov 4 10:35:44 1994 --- ./bfd/elf32-i386.c Wed Dec 14 09:26:08 1994 *************** *** 1035,1043 **** if (h->root.type == bfd_link_hash_defined) { sec = h->root.u.def.section; ! relocation = (h->root.u.def.value ! + sec->output_section->vma ! + sec->output_offset); } else if (h->root.type == bfd_link_hash_weak) relocation = 0; --- 1035,1059 ---- if (h->root.type == bfd_link_hash_defined) { sec = h->root.u.def.section; ! if (r_type == R_386_GOTPC ! || (r_type == R_386_PLT32 ! && h->plt_offset != (bfd_vma) -1) ! || (r_type == R_386_GOT32 ! && elf_hash_table (info)->dynamic_sections_created) ! || (info->shared ! && (r_type == R_386_32 ! || r_type == R_386_PC32) ! && (input_section->flags & SEC_ALLOC) != 0)) ! { ! /* In these cases, we don't need the relocation ! value. We check specially because in some ! obscure cases sec->output_section will be NULL. */ ! relocation = 0; ! } ! else ! relocation = (h->root.u.def.value ! + sec->output_section->vma ! + sec->output_offset); } else if (h->root.type == bfd_link_hash_weak) relocation = 0; *** ./bfd/i386linux.c.orig Mon Aug 22 11:00:32 1994 --- ./bfd/i386linux.c Tue Nov 29 02:12:59 1994 *************** *** 91,96 **** --- 91,102 ---- #define PLT_REF_PREFIX "__PLT_" #endif + /* Used to generate specialized error messages */ + + #ifndef NEEDS_SHRLIB + #define NEEDS_SHRLIB "__NEEDS_SHRLIB_" + #endif + #define IS_PLT_SYM(name) \ (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0) *************** *** 416,423 **** --- 422,453 ---- struct bfd_link_info *info = (struct bfd_link_info *) data; struct fixup *f, *f1; int is_plt; + char * missing_filename, *cpnt; struct linux_link_hash_entry *h1, *h2; boolean exists; + + if (h->root.root.type == bfd_link_hash_undefined && + strncmp(h->root.root.root.string, NEEDS_SHRLIB, strlen(NEEDS_SHRLIB)) == 0) + { + missing_filename = strdup(h->root.root.root.string + strlen(NEEDS_SHRLIB)); + cpnt = strrchr(missing_filename, '_'); + if (cpnt) + { + *cpnt = 0; + fprintf (stderr, + "ld: Output file requires shared library `%s.so.%s'\n", + missing_filename, cpnt + 1); + } + else + { + fprintf (stderr, + "ld: Output file requires shared library `%s'\n", + missing_filename); + } + free(missing_filename); + + abort (); + } /* If this symbol is not a PLT/GOT, we do not even need to look at it */ is_plt = IS_PLT_SYM (h->root.root.root.string); *** ./gas/config/tc-i386.c.orig Fri Oct 21 21:42:53 1994 --- ./gas/config/tc-i386.c Sun Dec 4 18:15:00 1994 *************** *** 1691,1699 **** insn_size += size; #ifdef BFD_ASSEMBLER if (r_type == BFD_RELOC_32 - && i.imms[n]->X_op == O_symbol && GOT_symbol ! && GOT_symbol == i.imms[n]->X_add_symbol) { r_type = BFD_RELOC_386_GOTPC; i.imms[n]->X_add_number += 3; --- 1691,1701 ---- insn_size += size; #ifdef BFD_ASSEMBLER if (r_type == BFD_RELOC_32 && GOT_symbol ! && GOT_symbol == i.imms[n]->X_add_symbol ! && (i.imms[n]->X_op == O_symbol ! || (i.imms[n]->X_op == O_add ! && i.imms[n]->X_add_symbol -> sy_value.X_op == O_constant))) { r_type = BFD_RELOC_386_GOTPC; i.imms[n]->X_add_number += 3; *************** *** 2420,2435 **** if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy) { value += fixP->fx_where + fixP->fx_frag->fr_address; - #ifdef OBJ_ELF - if (S_GET_SEGMENT (fixP->fx_addsy) != undefined_section) - { - /* Yes, we add the values in twice. This is because - bfd_perform_relocation subtracts them out again. I think - bfd_perform_relocation is broken, but I don't dare change - it. FIXME. */ - value += fixP->fx_where + fixP->fx_frag->fr_address; - } - #endif } /* Fix a few things - the dynamic linker expects certain values here, --- 2422,2427 ---- *** ./gas/Makefile.in.orig Tue Nov 29 11:03:26 1994 --- ./gas/Makefile.in Wed Dec 14 11:42:10 1994 *************** *** 53,59 **** includedir = $(prefix)/include docdir = $(datadir)/doc ! VERSION=2.5.2 SHELL = /bin/sh --- 53,59 ---- includedir = $(prefix)/include docdir = $(datadir)/doc ! VERSION=2.5.2.6 SHELL = /bin/sh *** ./gas/write.c.orig Mon Oct 17 22:12:25 1994 --- ./gas/write.c Fri Nov 11 14:22:41 1994 *************** *** 2271,2276 **** --- 2271,2290 ---- } } + #ifdef OBJ_ELF + if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy) + { + if (S_GET_SEGMENT (fixP->fx_addsy) == this_segment_type) + { + /* Yes, we add the values in twice. This is because + bfd_perform_relocation subtracts them out again. I think + bfd_perform_relocation is broken, but I don't dare change + it. FIXME. */ + add_number += fixP->fx_where + fixP->fx_frag->fr_address; + } + } + #endif + if (!fixP->fx_bit_fixP && size > 0) { valueT mask = 0; *** ./libiberty/basename.c.orig Thu Dec 8 15:15:18 1994 --- ./libiberty/basename.c Thu Dec 8 15:16:11 1994 *************** *** 44,50 **** char * basename (name) ! char *name; { char *base = name; --- 44,50 ---- char * basename (name) ! const char *name; { char *base = name; *** ./ld/ldver.c.orig Tue Nov 29 15:37:17 1994 --- ./ld/ldver.c Wed Dec 14 11:42:39 1994 *************** *** 29,35 **** ldversion (noisy) int noisy; { ! fprintf(stdout,"ld version 2.5.2 (with BFD %s)\n", BFD_VERSION); if (noisy) { --- 29,35 ---- ldversion (noisy) int noisy; { ! fprintf(stdout,"ld version 2.5.2.6 (with BFD %s)\n", BFD_VERSION); if (noisy) { *** ./ld/emultempl/elf32.em.orig Tue Sep 27 20:07:51 1994 --- ./ld/emultempl/elf32.em Sat Nov 12 16:53:49 1994 *************** *** 125,130 **** --- 125,131 ---- if (! bfd_elf32_size_dynamic_sections (output_bfd, command_line.soname, command_line.rpath, + command_line.export_dynamic, &link_info, &sinterp)) einfo ("%P%F: failed to set dynamic section sizes: %E\n"); *************** *** 206,215 **** asection *s; { lang_output_section_statement_type *place; ! asection *snew, **pps; lang_statement_list_type *old; lang_statement_list_type add; etree_type *address; const char *secname, *ps; lang_output_section_statement_type *os; --- 207,217 ---- asection *s; { lang_output_section_statement_type *place; ! asection *snew, **pps, *sec; lang_statement_list_type *old; lang_statement_list_type add; etree_type *address; + int has_dynamic; const char *secname, *ps; lang_output_section_statement_type *os; *************** *** 244,249 **** --- 246,264 ---- return false; secname = bfd_get_section_name (s->owner, s); + + /* In dynamic images, we cannot have orphaned relocation sections. + The .dynamic section will be all wrong, so for now we simply assert + this to be the case. The fix is simple - you need to add the relevant + relocation sections to the linker script so that they get bunched + with the other relocation sections. The .rel.plt must be the last + one always, or you get screwed up for other reasons. */ + + has_dynamic = 0; + for (sec = output_bfd->sections; sec ; sec = sec->next) + if(strcmp(sec->name,".dynamic") == 0) has_dynamic = 1; + + ASSERT(strncmp(secname,".rel",4) || !has_dynamic); /* Create the section in the output file, and put it in the right place. This shuffling to make the output file look neater, and *** ./ld/scripttempl/elf.sc.orig Fri Oct 14 19:15:55 1994 --- ./ld/scripttempl/elf.sc Sat Dec 10 00:54:19 1994 *************** *** 2,10 **** # Unusual variables checked by this code: # NOP - two byte opcode for no-op (defaults to 0) # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start ! # OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ... # (e.g., .PARISC.milli) ! # OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ... # (e.g., .PARISC.global) # OTHER_SECTIONS - at the end # EXECUTABLE_SYMBOLS - symbols that must be defined for an --- 2,10 ---- # Unusual variables checked by this code: # NOP - two byte opcode for no-op (defaults to 0) # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start ! # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... # (e.g., .PARISC.milli) ! # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... # (e.g., .PARISC.global) # OTHER_SECTIONS - at the end # EXECUTABLE_SYMBOLS - symbols that must be defined for an *************** *** 20,25 **** --- 20,26 ---- # When adding sections, do note that the names of some sections are used # when specifying the start address of the next. # + test -z "$ENTRY" && ENTRY=_start test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} test "$LD_FLAG" = "N" && DATA_ADDR=. *************** *** 29,34 **** --- 30,36 ---- OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") OUTPUT_ARCH(${ARCH}) + ENTRY(${ENTRY}) ${RELOCATING+${LIB_SEARCH_DIRS}} ${RELOCATING+/* Do we need any of these for elf? *************** *** 59,64 **** --- 61,70 ---- .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } + .rel.init ${RELOCATING-0} : { *(.rel.init) } + .rela.init ${RELOCATING-0} : { *(.rela.init) } + .rel.fini ${RELOCATING-0} : { *(.rel.fini) } + .rela.fini ${RELOCATING-0} : { *(.rela.fini) } .rel.bss ${RELOCATING-0} : { *(.rel.bss) } .rela.bss ${RELOCATING-0} : { *(.rela.bss) } .rel.plt ${RELOCATING-0} : { *(.rel.plt) } *************** *** 68,86 **** .text ${RELOCATING-0} : { ${RELOCATING+${TEXT_START_SYMBOLS}} ! *(.text) ! } ${RELOCATING+_etext = .;} ${RELOCATING+PROVIDE (etext = .);} .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} - .ctors ${RELOCATING-0} : { *(.ctors) } - .dtors ${RELOCATING-0} : { *(.dtors) } .rodata ${RELOCATING-0} : { *(.rodata) } .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+${OTHER_READONLY_SECTIONS}} /* Read-write section, merged into data segment: */ - ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};} .data ${RELOCATING-0} : { ${RELOCATING+${DATA_START_SYMBOLS}} --- 74,94 ---- .text ${RELOCATING-0} : { ${RELOCATING+${TEXT_START_SYMBOLS}} ! *(.text) ! } = ${NOP-0} ${RELOCATING+_etext = .;} ${RELOCATING+PROVIDE (etext = .);} .fini ${RELOCATING-0} : { *(.fini) } =${NOP-0} .rodata ${RELOCATING-0} : { *(.rodata) } .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+${OTHER_READONLY_SECTIONS}} + /* The last page of text may contain the beginning of data + * and the first page of data may contain the end of text. + * We first align to the page boundary. We then add the shift + * due to the extra end of text, but only if necessary. */ + ${RELOCATING+. = ALIGN(${MAXPAGESIZE}) + ((ALIGN(8) + ${MAXPAGESIZE} - ALIGN(${MAXPAGESIZE})) & (${MAXPAGESIZE} - 1));} /* Read-write section, merged into data segment: */ .data ${RELOCATING-0} : { ${RELOCATING+${DATA_START_SYMBOLS}} *************** *** 88,93 **** --- 96,103 ---- ${CONSTRUCTING+CONSTRUCTORS} } .data1 ${RELOCATING-0} : { *(.data1) } + .ctors ${RELOCATING-0} : { *(.ctors) } + .dtors ${RELOCATING-0} : { *(.dtors) } ${RELOCATING+${OTHER_READWRITE_SECTIONS}} .got ${RELOCATING-0} : { *(.got.plt) *(.got) } .dynamic ${RELOCATING-0} : { *(.dynamic) } *** ./ld/ld.h.orig Tue Sep 20 17:15:53 1994 --- ./ld/ld.h Fri Nov 11 14:30:37 1994 *************** *** 61,66 **** --- 61,70 ---- /* Big or little endian as set on command line. */ enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; + + /* If true, export all symbols in the dynamic symbol table of an ELF + executable. */ + boolean export_dynamic; } args_type; extern args_type command_line; *** ./ld/lexsup.c.orig Wed Oct 12 16:26:42 1994 --- ./ld/lexsup.c Sat Dec 3 09:49:23 1994 *************** *** 68,74 **** #define OPTION_DYNAMIC_LINKER (OPTION_DEFSYM + 1) #define OPTION_EB (OPTION_DYNAMIC_LINKER + 1) #define OPTION_EL (OPTION_EB + 1) ! #define OPTION_HELP (OPTION_EL + 1) #define OPTION_IGNORE (OPTION_HELP + 1) #define OPTION_MAP (OPTION_IGNORE + 1) #define OPTION_NO_KEEP_MEMORY (OPTION_MAP + 1) --- 68,75 ---- #define OPTION_DYNAMIC_LINKER (OPTION_DEFSYM + 1) #define OPTION_EB (OPTION_DYNAMIC_LINKER + 1) #define OPTION_EL (OPTION_EB + 1) ! #define OPTION_EXPORT_DYNAMIC (OPTION_EL + 1) ! #define OPTION_HELP (OPTION_EXPORT_DYNAMIC + 1) #define OPTION_IGNORE (OPTION_HELP + 1) #define OPTION_MAP (OPTION_IGNORE + 1) #define OPTION_NO_KEEP_MEMORY (OPTION_MAP + 1) *************** *** 106,111 **** --- 107,113 ---- {"EB", no_argument, NULL, OPTION_EB}, {"EL", no_argument, NULL, OPTION_EL}, {"end-group", no_argument, NULL, ')'}, + {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC}, {"format", required_argument, NULL, 'b'}, {"help", no_argument, NULL, OPTION_HELP}, {"Map", required_argument, NULL, OPTION_MAP}, *************** *** 205,210 **** --- 207,215 ---- case OPTION_EL: command_line.endian = ENDIAN_LITTLE; break; + case OPTION_EXPORT_DYNAMIC: + command_line.export_dynamic = true; + break; case 'e': lang_add_entry (optarg, 1); break; *************** *** 373,380 **** trace_file_tries = true; break; case 'v': - case 'V': ldversion (0); version_printed = true; break; case OPTION_VERSION: --- 378,388 ---- trace_file_tries = true; break; case 'v': ldversion (0); + version_printed = true; + break; + case 'V': + ldversion (1); version_printed = true; break; case OPTION_VERSION: *** ./ld/ldlang.c.orig Tue Sep 20 17:15:58 1994 --- ./ld/ldlang.c Sat Nov 12 12:15:38 1994 *************** *** 2106,2112 **** lang_finish () { struct bfd_link_hash_entry *h; ! boolean warn = link_info.relocateable ? false : true; if (entry_symbol == (char *) NULL) { --- 2106,2112 ---- lang_finish () { struct bfd_link_hash_entry *h; ! boolean warn = (link_info.relocateable || link_info.shared) ? false : true; if (entry_symbol == (char *) NULL) { *** ./include/libiberty.h.orig Wed Aug 10 16:19:49 1994 --- ./include/libiberty.h Thu Dec 8 15:18:00 1994 *************** *** 23,29 **** /* Return the last component of a path name. */ ! extern char *basename PARAMS ((char *)); /* Concatenate an arbitrary number of strings, up to (char *) NULL. Allocates memory using xmalloc. */ --- 23,29 ---- /* Return the last component of a path name. */ ! extern char *basename PARAMS ((const char *)); /* Concatenate an arbitrary number of strings, up to (char *) NULL. Allocates memory using xmalloc. */