aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't complain about no input files for `ld -f'. This fixes spuriousBruce Evans1997-04-251-2/+5
| | | | | | | | | (ignored :-() errors for `make depend' in /sys/i386/boot/*. It's natural for there to be no libraries there and inconvenient to check for this in bsd.prog.mk. Notes: svn path=/head/; revision=25141
* Fill the padding at the end of the runtime strings with zeros,John Polstra1997-04-251-2/+6
| | | | | | | | | instead of leaving random data there. This makes the linker's output files more deterministic -- an important property for regression tests. Notes: svn path=/head/; revision=25139
* Fixed `make depend' and related bogons. LDFLAGS was used forBruce Evans1997-04-161-10/+2
| | | | | | | | | | | | | | ld-specific flags. LDFLAGS is really for ld-related flags for cc, not for ld, and some flags, e.g., -Bshareable, mean completely different things to cc and ld. Having the wrong things in LDFLAGS also broke the standard ${PROG} target. This was kludged around by using a special rule that depended on LDFLAGS being bogus. Fixing `make depend' broke the special rule but fixed the standard rule (except in the DESTDIR case, which was handled more strictly here than elsewhere). Notes: svn path=/head/; revision=24979
* Don't print nonexistent library names for `ld -f [-Lfoo] -lbar'. ABruce Evans1997-04-111-2/+10
| | | | | | | | | | | | dependency on `bar' is very unlikely to be correct. This is a quick fix for broken dependencies in gdb and many other places. The dependencies on internal libraries are now missing instead of wrong when `make depend' is run before the libraries are created. Notes: svn path=/head/; revision=24814
* Add a new "-f" option to the linker, to print the resolved pathsJohn Polstra1997-03-223-5/+43
| | | | | | | | | of all the files and libraries in the command line. Submitted by: bde (Bruce Evans) Notes: svn path=/head/; revision=24097
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-2236-36/+36
| | | | Notes: svn path=/head/; revision=22996
* Fix a bug involving alias (N_INDR) symbols. When building a sharedJohn Polstra1997-02-011-2/+8
| | | | | | | | | | | | | | | | | | library with a shared object dependency that contained alias symbols, the linker incorrectly counted the number of symbols that would be written, resulting in a fatal internal error. Since our libc now contains some alias symbols (in "net/res_stubs.c"), this was sufficient to tickle the bug: "ld -Bshareable foo.so -lc". To fix it, I moved the accounting of alias symbols to a later point in the processing, where it is possible to count only those symbols that will actually be written to the output file. This fix is well-confined to affect alias symbols only. I have tested it with a full "make world". I am going to merge it into -2.2 after a few more days of living with it in -current. Notes: svn path=/head/; revision=22187
* Use xmalloc instead of malloc in two places, so that out-of-memoryJohn Polstra1997-01-242-2/+2
| | | | | | | | | conditions will be detected. Submitted by: Philippe Charnier <charnier@xp11.frmug.org> Notes: svn path=/head/; revision=21967
* Pay attention to the environment variable "LD_IGNORE_MISSING_OBJECTS".John Polstra1997-01-172-1/+36
| | | | | | | | | | | | If it is set to a nonempty string, then simply skip any missing shared libraries. This came up in a discussion long ago as a potentially useful feature at sysinstall time. For example, an X11 utility could be used without the X libraries being present, provided the utility had a mode in which no X functions were actually called. Notes: svn path=/head/; revision=21819
* If a library is found in the hints file, but the library doesn't exist,John Polstra1997-01-141-0/+4
| | | | | | | | | | | | ignore the hint. This is a straightforward fix, and it should go into 2.2 after a burn-in period of a few days. Noticed by: bde Notes: svn path=/head/; revision=21693
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-1436-36/+36
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Sort cross references.Wolfram Schneider1997-01-133-9/+9
| | | | Notes: svn path=/head/; revision=21635
* Use the RTLD_NOW symbol, now that it is defined in <dlfcn.h>.John Polstra1997-01-121-4/+3
| | | | Notes: svn path=/head/; revision=21620
* Correct typos and spelling errors.John Polstra1997-01-121-5/+5
| | | | Notes: svn path=/head/; revision=21578
* Add support for the LD_BIND_NOW environment variable. If it is set to aJohn Polstra1997-01-122-23/+54
| | | | | | | | | | | | | | | | | | | | | | | | nonempty string, then function calls are relocated at program start-up rather than lazily. This variable is standard on Sun and SVR4 systems. The dlopen() function now supports both lazy and immediate binding, as determined by its "mode" argument, which can be either 1 (RTLD_LAZY) or 2 (RTLD_NOW). I will add defines of these symbols to <dlfcn.h> as soon as I've done a little more checking to make sure they won't cause collisions or bootstrapping problems that would break "make world". The "LD_*" environment variables which alter dynamic linker behavior are now treated as unset if they are set to the empty string. This agrees with the standard SVR4 conventions for the dynamic linker. Add a work-around for programs compiled with certain buggy versions of crt0.o. The buggy versions failed to set the "crt_ldso" member of the interface structure. This caused certain error messages from the dynamic linker to begin with "(null)" instead of the pathname of the dynamic linker. Notes: svn path=/head/; revision=21577
* Set LD_TRACE_LOADED_OBJECTS to "1" instead of to "". The dynamic linkerJohn Polstra1997-01-121-2/+2
| | | | | | | | now treats empty "LD_*" environment variables as if they were unset, per the standard SVR4 conventions. Notes: svn path=/head/; revision=21576
* Add support for the LD_BIND_NOW environment variable. If it is set to aJohn Polstra1997-01-122-2/+21
| | | | | | | | | | | | | | nonempty string, then function calls are relocated at program start-up rather than lazily. This variable is standard on Sun and SVR4 systems. The dlopen() function now supports both lazy and immediate binding, as determined by its "mode" argument, which can be either 1 (RTLD_LAZY) or 2 (RTLD_NOW). I will add defines of these symbols to <dlfcn.h> as soon as I've done a little more checking to make sure they won't cause collisions or bootstrapping problems that would break "make world". Notes: svn path=/head/; revision=21574
* Changes to make ld demangle C++ symbol names before printingJoshua Peck Macdonald1997-01-117-1048/+94
| | | | | | | | | error messages containing them. Reviewed by: Peter Wemm Notes: svn path=/head/; revision=21525
* For "ldd -v", print shared object dependencies that were specified asJohn Polstra1997-01-101-3/+6
| | | | | | | | pathnames (rather than as "-lfoo") correctly. Closes PR bin/2404. Notes: svn path=/head/; revision=21469
* Fix spelling error in manpage.Steven Wallace1996-12-261-2/+2
| | | | Notes: svn path=/head/; revision=20930
* Made the synopsis in the man page conform to the style guide.Bruce Evans1996-11-302-7/+3
| | | | | | | | | Made the usage message conform to the style guide. Don't use the implementation variable `__progname'. Notes: svn path=/head/; revision=20050
* make the Usage string match realityPeter Wemm1996-11-221-2/+4
| | | | | | | Submitted by: faried nawaz <fn@uidaho.edu>, PR#2075 Notes: svn path=/head/; revision=19926
* Document that "ldconfig -m" rescans all directories previouslyJohn Polstra1996-11-091-3/+6
| | | | | | | | | | entered into the hints file, in addition to the directories named on the command line. 2.2 Candidate. Notes: svn path=/head/; revision=19584
* Fixed a bug in the handling of the directories in the search pathJohn Polstra1996-11-081-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | that is stored in the hints file. If that search path contained a non-existent directory (one, say, that had been removed), and "ldconfig -m /a/perfectly/good/directory" was run, ldconfig returned an error status without printing an error message. This caused some confusing bombs when installing ports, in particular. I changed it so that non-existent directories from the stored search path are silently ignored. Only non-existent directories named explicitly on the command line are treated as errors. Also, a diagnostic is printed if and only if an error status is returned. In an unrelated fix, ldconfig now silently ignores any directories named on the command line when the "-r" option is given. Formerly, these directories incorrectly made their way into the "search directories" line of the listing. It really should be an error to specify directories together with "-r", but I don't have time to fix the manual page in that way right now. 2.2 Candidate. Notes: svn path=/head/; revision=19522
* oops, uninitialised variable.. -v mode depended on stack contents.Peter Wemm1996-10-291-2/+2
| | | | | | | Submitted by: Masafumi NAKANE <max@wide.ad.jp>, PR#1920 Notes: svn path=/head/; revision=19253
* If errors occur during the loading of the shared libraries required byJohn Polstra1996-10-241-10/+30
| | | | | | | | | | | | | | | | the main program, report them directly from the dynamic linker and die there, rather than returning an error message to crt0.o. This enables the printing of error messages even for old executables, whose version of crt0.o is not able to print them. This fix closes PR bin/1869. The code in crt0.o for printing error messages from the dynamic linker is no longer used, because of this change. But it must remain, for backward compatibility with older dynamic linkers. Notes: svn path=/head/; revision=19158
* Fix two minor typos in the manual page.John Polstra1996-10-181-3/+3
| | | | Notes: svn path=/head/; revision=19010
* Add the search directories from the hints file only the first time it isJohn Polstra1996-10-101-2/+5
| | | | | | | | | opened. After that, the directories are already present, and there is no point in adding them again. This doesn't fix any bugs; it's just for efficiency. Notes: svn path=/head/; revision=18862
* Add a new option "-f hints_file" to specify an alternate file instead ofJohn Polstra1996-10-102-37/+37
| | | | | | | | | | "/var/run/ld.so.hints". Delete an incorrect statement about LD_LIBRARY_PATH from the manual page. Notes: svn path=/head/; revision=18859
* Fix a bug that caused a segmentation violation if dlsym() was calledJohn Polstra1996-10-101-2/+2
| | | | | | | with its first argument equal to NULL. Notes: svn path=/head/; revision=18849
* There's no need to 'unsetenv()' unsafe environment variables explicitlyNate Williams1996-10-011-6/+1
| | | | | | | | | since rt_readenv() already takes care of not setting unsafe variables. This was part of the changes I submitted to Peter and John during the review which must have gotten missed. Notes: svn path=/head/; revision=18625
* Sigh, oh well, here's my obligigatory "oops" commit. I don't quite knowPeter Wemm1996-10-011-1/+13
| | | | | | | | | | how I managed to get this out of sync, but I did. I guess that's what I get for directly committing from different machines that I was testing on. Pointed out by: Paul Traina <pst@freebsd.org> Notes: svn path=/head/; revision=18618
* Incorporate John Polstra's sods.c display of the details about thePeter Wemm1996-10-014-4/+533
| | | | | | | | dynamic linking information in the executable. It's quite extensive. It's connected to ldd's (new) -v option. Notes: svn path=/head/; revision=18600
* Update to handle new version ld.so.hints and info in executable forPeter Wemm1996-10-014-63/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configurable fallback search paths, as well as new crt interface version. Also: - even faster getenv(), get all environment variable settings in a single pass. - ldd printf-like format specifications - minor code cleanups, one vsprintf -> vsnprintf (harmless) The library search sequence is a little more complete now. Before, it'd search $LD_LIBRARY_PATH (by opendir/readdir/closedir), then read the hints file, then read /usr/lib (again by scanning thr directory). It would then fail if there was no "found" library. Now, it does LD_LIBRARY_PATH and the hints file the same, but then uses a longer fallback path. The -R path is fetched from the executable if specified at build time, the ldconfig path is appended, and /usr/lib is appended to that. Duplicates are suppressed. This means that simply placing a new library in /usr/local/lib will work (the same as it did in /usr/lib) without needing ldconfig -m. It will find it quicker if the ldconfig is run though. Similar changes have been made to the NetBSD ld.so, but ours is rather different now due to John Polstra's speedups and fixes from a while back. The ldd printf-like format support came direct from NetBSD. Reviewed by: nate, jdp Notes: svn path=/head/; revision=18599
* Support for specifying printf-like output specs to control the ldd outputPeter Wemm1996-10-012-4/+32
| | | | | | | | | | as present in the new rtld version. Obtained from: NetBSD Reviewed by: nate, jdp Notes: svn path=/head/; revision=18598
* Updates to deal with ld.so.hints version 2. It now deals with thePeter Wemm1996-10-012-18/+53
| | | | | | | | | | | ldconfig path (from NetBSD). I added code to make sure there were no duplicates in the path when multiple ldconfig -m's were used. Reviewed by: nate, jdp Obtained from: NetBSD (partly) Notes: svn path=/head/; revision=18597
* Update the backends to go with the top-level ld changes. The non-i386Peter Wemm1996-10-015-14/+47
| | | | | | | | | | changes are for completeness, I don't think they work. There are changes to deal with the new include files. Obtained from: NetBSD (mostly) Notes: svn path=/head/; revision=18596
* Support for .weak (in addition to the N_INDR stab) for gcc/g++. Also dealPeter Wemm1996-10-0117-569/+959
| | | | | | | | | | | | | with the -R option and store the path in the dynamic header when specified. The $LD_RUN_PATH environment variable is not checked yet. While here, split up the code a bit more to enable more selective replacing of GPL'ed components that are linked with ld.so with others. Obtained from: NetBSD (mostly, the breakup is my fault) Notes: svn path=/head/; revision=18595
* add missing comma(s) in .Xr macrosWolfram Schneider1996-09-231-3/+3
| | | | Notes: svn path=/head/; revision=18480
* Use `install -C' instead of lots of shell commands to install ld.soBruce Evans1996-09-121-13/+2
| | | | | | | | | | | | as atomically as possible. (Immutable targets can't be renamed without opening a window when neither the source nor the target is immutable. Perhaps there should be a rename_immutable syscall to do this if unsetting the immutable flags would work.) Notes: svn path=/head/; revision=18258
* [HISTORY] command appeared in Version 1 AT&T UNIXWolfram Schneider1996-08-292-4/+12
| | | | | | | Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41 Notes: svn path=/head/; revision=17891
* General -Wall warning cleanup, part I.Jordan K. Hubbard1996-07-126-20/+24
| | | | | | | Submitted-By: Kent Vander Velden <graphix@iastate.edu> Notes: svn path=/head/; revision=17142
* Aw c'mon. I'm being driven mad by plenty of other things. I don'tBill Paul1996-06-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | need this. Consider the following code: case 'O': output_filename = malloc(strlen(arg)+4); strcpy(output_filename, arg); strcat(output_filename, ".tmp"); real_output_filename = arg; return; The idea here is to malloc() a buffer big enough to hold the name of a supplied file name, plus ".tmp". So we malloc() 'size of filename' bytes plus 4, right? Wrong! ".tmp" is _FIVE_ bytes long! There's a traling '\0' which strcat() gleefully tacks on _outside_ the bounds of the buffer. Result: program corrupts own memory. Program SEGVs at seemingly random times. Bill not like random SEGVs. Bill smash. Know how I found this? I've been trying to bootstrap -current on my 2.1.0-RELEASE machine at work and I couldn't seem to get libc.a built because the linker would intermittently blow chunks while executing things like 'ld -O foo.o -X -r foo.o'. Since this is an initial bootstrap version of ld, it was linked against the 2.1.0 libc, who's malloc() behaves differently than that in -current. Presumeably ld -O doesn't blow up in -current, otherwise someone would have spotted this already. I don't know if this is a bug or a feature. Anyway. I'm changing the strlen(arg)+4 to strlen(arg)+5. Bah. Notes: svn path=/head/; revision=16191
* Add an option -O <filename> to ld. From the manpage:Poul-Henning Kamp1996-05-283-3/+30
| | | | | | | | | | | -O filename Specifies the name of the output file. The file is created as filename.tmp and when output is complete renamed to filename. This allows us to: ld -O ${.TARGET} -x -r ${.TARGET} Notes: svn path=/head/; revision=15958
* Zero out an unused field in a structure that is written to the outputJohn Polstra1996-05-271-1/+2
| | | | | | | | | | file. The field formerly contained random garbage, leading to spurious differences between otherwise identical executables and libraries. Submitted by: Bruce Evans <bde@freebsd.org> Notes: svn path=/head/; revision=15939
* When checking to see whether a needed shared library has alreadyJohn Polstra1996-05-221-2/+36
| | | | | | | | | | | | | | been loaded, look for a match by device and inode number if the traditional pathname comparisons don't find a match. This detects the case in which a library is requested using two different names which are really links to the same file, and avoids loading it twice. Requested by: peter@freebsd.org Reviewed by: peter@freebsd.org Notes: svn path=/head/; revision=15861
* ``mv'' -> ``mv -f''Wolfram Schneider1996-05-071-3/+3
| | | | | | | | ``rm'' -> ``rm -f'' so mv/rm may not ask for confirmation if you are not root Notes: svn path=/head/; revision=15679
* When a local symbol that would normally be eliminated by "-x" orJohn Polstra1996-04-241-1/+12
| | | | | | | | | | | "-X" must survive, because of references from relocations, don't qualify the symbol name with the name of the input file. This saves some string space. It makes libc_pic.a about 2.4% smaller. Adapted from a suggestion by Bruce Evans. Notes: svn path=/head/; revision=15374
* Implement support for LD_PRELOAD in the dynamic linker. RemoveJohn Polstra1996-04-202-14/+110
| | | | | | | | | | descriptions of LD_NO_INTERN_SEARCH and LD_NOSTD_PATH from the manual page, since they are not supported. Submitted by: Doug Ambrisko <ambrisko@ambrisko.roble.com> Notes: svn path=/head/; revision=15326
* Implement support for LD_PRELOAD in the dynamic linker.John Polstra1996-04-202-2/+29
| | | | | | | Submitted by: Doug Ambrisko <ambrisko@ambrisko.roble.com> Notes: svn path=/head/; revision=15325