aboutsummaryrefslogtreecommitdiff
path: root/sbin/ldconfig/ldconfig.c
Commit message (Collapse)AuthorAgeFilesLines
* ldconfig: remove ignored -v (verbose) optionStefan Eßer2024-03-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | The -v option used to print useful information when operating on a.out format libraries. After the removal of a.out support, it was accepted but did not have any effect. Remove the option and update the man-page. While here mention the set of historic options that are accepted but ignored: "-elf", "-s", and "-v". The FILES section contained outdated information and did not mention the way library directories of optional ports and packages are included in the library search path recorded in the hints file. The description of the "-B" option was incorrect (described a planned change) for big-endian platforms (powerpc64). These do still default to big-endian hints files, since the current version of the "pkg" program expects the hints file to be in native byte-order. Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D44139
* ldconfig: support hints files of either byte-orderStefan Eßer2024-02-281-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the ldconfig program accept hints files in little-endian and big-endian format on all architectures. The default format is the native byte-order of the respective host. This is expected to change when a version of the pkg command is available that implements support for either byte-order in its internal ldconfig function. (Already committed in the development tree of the pkg utility, a release is expected at the end of Q1/2024). This update adds the -B option to the ldconfig program. It enforces the creation of a big-endian hints file on a little-endian host. The main purpose to is support of tests with non-native byte-order files on little-endian hosts. It will be removed when all supported FreeBSD releases use little-endian hints files by default. When little-endian hints files are generally used, support of either byte-order in libexec/rtld can also be removed. When support for big-endian hints files is no longer required, the COND_SWAP macro in ldconfig and rtld shall be replaced by le32toh(), which just return their argument on little-endian architectures. Approved by: kib MFC after: 1 month Relnotes: yes Differential Revision: https://reviews.freebsd.org/D44093
* ldconfig: Use __PATH_ELF_HINTS("32") over _PATH_ELF32_HINTSJessica Clarke2023-07-091-1/+1
| | | | | | | | This will allow the latter to be removed, reducing the boilerplate needed for a new libcompat. Reviewed by: kib, brooks, jhb Differential Revision: https://reviews.freebsd.org/D40933
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-07-071-1/+1
| | | | | | | | In most cases, usage does not return, so mark them as __dead2. For the cases where they do return, they have not been marked __dead2. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/735
* ldconfig: remove two symbolsKonstantin Belousov2022-01-081-3/+0
| | | | | | | | _PATH_LD32_HINTS is unused because it is a.out remnant. _PATH_ELF32_HINTS is provided by rtld_paths.h already. Sponsored by: The FreeBSD Foundation MFC after: 1 week
* ldconfig: remove libsoft supportWarner Losh2022-01-071-10/+3
| | | | | | | Remove support for -soft and its implementation. This arg was never documented, so no need to remove it from the man page. Sponsored by: Netflix
* ldconfig(8): check for no-args command line after options are parsedKonstantin Belousov2021-11-241-5/+6
| | | | | | | | | | | | | | | | | | | Default action for ldconfig is specified as -R AKA 'append', and for no-args (without options changing default actions), ldconfig should append empty list of directories to current list. But because the check was done before options were parsed out, presence of any option turned off default rescan. As result, innocently-looked commands like `ldconfig -v' were interpreted as setting directory hints list to one specified on the command line, i.e. empty. Reported by: https://github.com/mesonbuild/meson/issues/9592 Reviewed by: emaste Tested by: jbeich Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058
* ldconfig: use libexec/rtld-elf/rtld_paths.hKonstantin Belousov2021-11-241-1/+2
| | | | | | | | | | instead of duplicating definitions using slighly different macro names. Reviewed by: emaste Tested by: jbeich Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058
* ldconfig(8): nostd/-s does nothingKonstantin Belousov2021-11-241-4/+4
| | | | | | | | | | | Remove the option from man page and summary. Silently ignore it when parsing command line for backward compatibility. Reviewed by: emaste Tested by: jbeich Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058
* ldconfig: start of cleanupKonstantin Belousov2021-11-241-36/+19
| | | | | | | | | | | | | | Use bool. Use local variables instead of static. Remove non-functional debugging override of hints file path. Use explicit exit() instead of return from main. Minor style tweaks. Reviewed by: emaste Tested by: jbeich Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058
* ldconfig: remove a comment which is another remnant of a.out supportKonstantin Belousov2021-11-241-1/+1
| | | | | | | Noted and reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33058
* ldconfig: Retire a.out supportEd Maste2020-12-311-500/+11
| | | | | | | | | | | | aout support in ldconfig hasn't been required since FreeBSD 2.x. If someone needs to use FreeBSD 2 shared libraries they will be best served by using a FreeBSD 2 ldconfig as well. In aa5e1b42e6e3 we removed the ldconfig a.out invocation from rc.d but left the support in ldconfig itself. Remove it now. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27481
* ldconfig: add aout deprecation noticeEd Maste2020-03-171-0/+1
| | | | | | | | | | | aout support in ldconfig hasn't been required since FreeBSD 2.x. Anyone still using FreeBSD 2 shared libraries can also use a FreeBSD 2 ldconfig to generate aout ldconfig hints. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=359037
* Make ldconfig(8) atomic, by removing an unneccessary call to unlink(2)Edward Tomasz Napierala2018-08-091-7/+0
| | | | | | | | | | | | before rename(2). Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16641 Notes: svn path=/head/; revision=337530
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* Use MAP_PRIVATE instead of obsolete MAP_COPY. No functional changes.Edward Tomasz Napierala2017-10-301-2/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=325134
* Add ldconfig -soft to process the soft float abi libraries and put itWarner Losh2016-01-181-1/+9
| | | | | | | into startup scripts for armv6. It acts much like ldconfig -32 does. Notes: svn path=/head/; revision=294295
* Add a comment about why aout support is still here: We need it forWarner Losh2013-03-191-0/+7
| | | | | | | compat2x, which is still in use, as evidence by recent bug reports. Notes: svn path=/head/; revision=248525
* ANSIfy ldconfig and the aout bits it still uses from rtld-aout.Ed Schouten2009-12-291-13/+7
| | | | | | | (Why is aout support still there?) Notes: svn path=/head/; revision=201217
* Remove unused reference to objformat.hPeter Wemm2007-01-251-1/+0
| | | | Notes: svn path=/head/; revision=166244
* Document -32 flag in usage() output as well.John Baldwin2005-11-111-1/+1
| | | | | | | | Requested by: ru MFC after: 1 week Notes: svn path=/head/; revision=152323
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-101-1/+1
| | | | Notes: svn path=/head/; revision=141611
* Improve readability for the recently introduced changes by havingXin LI2005-01-141-4/+4
| | | | | | | | | their sizeof(*p) instead of explicitlly specifying their types. Suggested by: nectar Notes: svn path=/head/; revision=140248
* Use a better name than underscore-tmpfile for better representationXin LI2005-01-141-5/+5
| | | | | | | | | of the meaning. Suggested by: stefanf Notes: svn path=/head/; revision=140244
* 64-bit clean + WARNS=6:Xin LI2005-01-141-21/+26
| | | | | | | | | | | | | | | | | | | | - Convert the (char *) cast+cast backs magic to memcpy(3). Without this, the resulting code is potentially risky with higher optimization levels. - Avoid same name when calling local variables, as well as global symbols. This reduces confusion for both human and compiler. - Add necessary casts, consts - Use new style function defination. - Minor style.Makefile(5) tweak - Bump WARNS?= from 0 to 6 ** for the aout code: changes are intentionally limited to ease maintaince. Notes: svn path=/head/; revision=140241
* Avoid using void pointers in additive expressions.Stefan Farfeleder2004-08-141-2/+2
| | | | | | | PR: 56653 Notes: svn path=/head/; revision=133723
* Add initial support for compiling a special 32 bit version ofPeter Wemm2004-03-211-12/+26
| | | | | | | | | | ld-elf.so.1 on 64 bit systems. Most of this involves using alternate paths, environment variables and diagnostic messages. The build glue is seperate. Notes: svn path=/head/; revision=127250
* Fix 10 year old size-of-bcopy bug.Colin Percival2004-03-131-1/+1
| | | | | | | | | | | PR: bin/43930 Submitted by: Alan Barrett Approved by: rwatson (mentor) MFNetBSD: revision 1.35 MFC after: 3 days Notes: svn path=/head/; revision=126896
* Initiate deorbit burn for the i386-only a.out related support. Moves arePeter Wemm2002-09-171-9/+10
| | | | | | | | | | | | | | | | | | under way to move the remnants of the a.out toolchain to ports. As the comment in src/Makefile said, this stuff is deprecated and one should not expect this to remain beyond 4.0-REL. It has already lasted WAY beyond that. Notable exceptions: gcc - I have not touched the a.out generation stuff there. ldd/ldconfig - still have some code to interface with a.out rtld. old as/ld/etc - I have not removed these yet, pending their move to ports. some includes - necessary for ldd/ldconfig for now. Tested on: i386 (extensively), alpha Notes: svn path=/head/; revision=103436
* o __P removedWarner Losh2002-03-211-7/+7
| | | | | | | o main prototype removed Notes: svn path=/head/; revision=92882
* Remove 'register' keyword.David E. O'Brien2002-03-201-2/+2
| | | | | | | | | It does not help modern compilers, and some may take some hit from it. (I also found several functions that listed *every* of its 10 local vars with "register" -- just how many free registers do people think machines have?) Notes: svn path=/head/; revision=92806
* * include/elf.h has been repo copied to include/elf-hints.h, and it noDavid E. O'Brien2001-05-021-1/+1
| | | | | | | | | | | longer includes machine/elf.h. * consumers of elf.h now use the minimalist elf header possible. This change is motivated by Binutils 2.11.0 and too much clashing over our base elf headers and the Binutils elf headers. Notes: svn path=/head/; revision=76224
* Add a "-i" option ("insecure") which disables the checks forJohn Polstra2000-08-071-17/+6
| | | | | | | | | | root ownership, etc. I will soon commit a companion knob for "/etc/rc.conf". Submitted by: Maxime Henrion <mhenrion@cybercable.fr> Notes: svn path=/head/; revision=64360
* If a directory is world-writable or is not owned by root, skip itJohn Polstra2000-07-261-0/+15
| | | | | | | | | | | | | | and emit a warning. This is a security measure since ldconfig influences the shared libraries used by all programs. I think the check should be made even more stringent by also ignoring group-writable directories. I will make that change soon unless we encounter a good reason not to do it. Submitted by: Maxime Henrion <mhenrion@cybercable.fr> Notes: svn path=/head/; revision=63872
* Make "ldconfig" with no arguments behave the same as "ldconfig -R".John Polstra2000-07-091-1/+3
| | | | | | | Submitted by: Maxime Henrion <mhenrion@cybercable.fr> Notes: svn path=/head/; revision=62858
* Fix insecure tempfile handlingKris Kennaway2000-01-161-8/+4
| | | | | | | Reviewed by: audit@freebsd.org Notes: svn path=/head/; revision=56125
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Make usage() reflect reality (add the -aout and -elf options).Bill Fumerola1999-04-211-2/+2
| | | | | | | OK'd by: bde Notes: svn path=/head/; revision=45925
* Add a new library function getobjformat(). It checks all theJohn Polstra1998-09-091-73/+16
| | | | | | | | | | | | | | | | standard places ("/etc/objformat", ${OBJFORMAT}, argv) for an indication of the user's preferred object file format. This consolidates some code that was starting to be duplicated in more and more places. Use the new function in ldconfig. Note: I don't think that gcc should use getobjformat(), even though it could. The compiler should limit itself to functions that are widespread, to ease porting and cross-compilation. Notes: svn path=/head/; revision=38960
* Fix calls to mmap. It returns void *, and on failure it returnsJohn Polstra1998-09-061-11/+11
| | | | | | | | | | | | | | MAP_FAILED. Don't try to extend the mapping in place if it is too short. There's no guarantee it will be possible. Remap the file instead. Put in a few style fixes. Submitted by: Bruce Evans <bde> Notes: svn path=/head/; revision=38885
* For a.out mode, ignore shared libraries that don't have at least 2John Polstra1998-09-051-1/+3
| | | | | | | version numbers. Notes: svn path=/head/; revision=38868
* Implement ldconfig functionality for ELF. The hints are stored inJohn Polstra1998-09-051-9/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | a different file than the a.out hints, namely, "/var/run/ld-elf.so.hints". These hints consist only of the directory search path. There is no hash table as in the a.out hints, because ELF doesn't have to search for the file with the highest minor version number. (It doesn't have minor version numbers at all.) A single run of ldconfig updates either the a.out hints or the ELF hints, but not both. The set of hints to process is selected in the usual way, via /etc/objformat, or ${OBJFORMAT}, or the "-aout" or "-elf" command line option. The rationale is that you probably want to search different directories for ELF than for a.out. "ldconfig -r" is faked up to produce output like we are used to, except that for ELF there are no minor version numbers. This should enable "ldconfig -r" to be used for checking LIB_DEPENDS in ports even for ELF. I implemented the ELF functionality in a new source file, with an eye toward eliminating the a.out code entirely at some point in the future. Notes: svn path=/head/; revision=38836
* Fixed printf format errors.Bruce Evans1998-08-021-4/+5
| | | | Notes: svn path=/head/; revision=38023
* Add rcsid. remove unused #includes. Getopt returns -1 not EOF. Add usage().Philippe Charnier1998-07-061-23/+27
| | | | | | | Cosmetics in err(3) string. Notes: svn path=/head/; revision=37420
* Fixed printf format errors.Bruce Evans1998-06-281-4/+3
| | | | Notes: svn path=/head/; revision=37237
* ELF preparation step 2:Søren Schmidt1998-05-261-2/+7
| | | | | | | | | | | | | | | | | Move a.out libraries to /usr/lib/aout to make space for ELF libs. Make rtld usr /usr/lib/aout as default library path. Make ldconfig reject /usr/lib as an a.out library path. Fix various Makefiles for LIBDIR!=/usr/lib breakage. This will after a make world & reboot give a system that no longer uses /usr/lib/*, infact one could remove all the old libraries there, they are not used anymore. We are getting close to an ELF make world, but I'll let this all settle for a week or two... Notes: svn path=/head/; revision=36397
* Add -R (rescan or refresh) option to rescan and rebuild the hintsPeter Wemm1997-08-221-10/+19
| | | | | | | | | | | | | | file based on the previous list of directories stored there which should overcome a weakness of the '-m' switch which can only add libs. This is an ideal way of updating the hints list after adding or removing a shlib since it will remove entries that are gone and doesn't need to have all the directories spelled out each time. (eg: rm -f /usr/lib/libtcl75*; ldconfig -R) This only works for version 2 hints files (which we've been generating for a year or so) which store the path. Notes: svn path=/head/; revision=28559
* Allow ldconfig to accept files (containing directory paths) as well asJordan K. Hubbard1997-07-111-6/+57
| | | | | | | | | directory paths. Reviewed by: jkh & jdp Submitted by: Hans Zuidam <hans@brandinnovators.com> Notes: svn path=/head/; revision=27334
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22996
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | 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