aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/linker.h
Commit message (Collapse)AuthorAgeFilesLines
* stand/multiboot2: add support for booting a Xen dom0 in UEFI modeRoger Pau Monné2021-02-161-0/+1
| | | | | | | | | | | | | | | | | | | | Add some basic multiboot2 infrastructure to the EFI loader in order to be capable of booting a FreeBSD/Xen dom0 when booted from UEFI. Only a very limited subset of the multiboot2 protocol is implemented in order to support enough to boot into Xen, the implementation doesn't intend to be a full multiboot2 capable implementation. Such multiboot2 functionality is hooked up into the amd64 EFI loader, which is the only architecture that supports Xen dom0 on FreeBSD. The options to boot a FreeBSD/Xen dom0 system are exactly the same as on BIOS, and requires setting the xen_kernel and xen_cmdline options in loader.conf. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28497
* vt: if loader did pass the font via metadata, use itToomas Soome2020-11-301-0/+1
| | | | | | | | The built in 8x16 font may be way too small with large framebuffer resolutions, to improve readability, use loader provied font. Notes: svn path=/head/; revision=368184
* Add a routine to dump boot metadataMitchell Horne2020-10-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The boot metadata (also referred to as modinfo, or preload metadata) provides information about the size and location of the kernel, pre-loaded modules, and other metadata (e.g. the EFI framebuffer) to be consumed during by the kernel during early boot. It is encoded as a series of type-length-value entries and is usually constructed by loader(8) and passed to the kernel. It is also faked on some architectures when booted by other means. Although much of the module information is available via kldstat(8), there is no easy way to debug the metadata in its entirety. Add some routines to parse this data and allow it to be printed to the console during early boot or output via a sysctl. Since the output can be lengthly, printing to the console is gated behind the debug.dump_modinfo_at_boot kenv variable as well as the BOOTVERBOSE flag. The sysctl to print the metadata is named debug.dump_modinfo. Reviewed by: tsoome Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26687 Notes: svn path=/head/; revision=366542
* sys: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365223
* Rerun kernel ifunc resolvers after all CPUs have startedAndrew Turner2020-07-051-0/+6
| | | | | | | | | | | | | | | | | | | On architectures that use RELA relocations it is safe to rerun the ifunc resolvers on after all CPUs have started, but while they are sill parked. On arm64 with big.LITTLE this is needed as some SoCs have shipped with different ID register values the big and little clusters meaning we were unable to rely on the register values from the boot CPU. Add support for rerunning the resolvers on arm64 and amd64 as these are both RELA using architectures. Reviewed by: kib Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25455 Notes: svn path=/head/; revision=362944
* [PowerPC][Book-E] Fix missing load base in elf_cpu_parse_dynamic().Brandon Bergren2020-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | When I implemented MD DYNAMIC parsing, I was originally passing a linker_file_t so that the MD code could relocate pointers. However, it turns out this isn't even filled in until later, so it was always 0. Just pass the load base (ef->address) directly, as that's really the only thing we were interested in in the first place. This fixes a crash on RB800 where it was trying to write to an unmapped address when updating the GOT. Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D24105 Notes: svn path=/head/; revision=359062
* Remove sparc64 kernel supportWarner Losh2020-02-031-2/+2
| | | | | | | | | Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs Notes: svn path=/head/; revision=357455
* Unbreak build. It seems that mips and amd64 still pull in link_elf.c, soBrandon Bergren2019-12-241-3/+0
| | | | | | | | we need to have elf_cpu_parse_dynamic() everywhere after all to avoid an undefined symbol. Notes: svn path=/head/; revision=356058
* [PowerPC] Implement Secure-PLT jump table processing for ppc32.Brandon Bergren2019-12-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Due to clang and LLD's tendency to use a PLT for builtins, and as they don't have full support for EABI, we sometimes have to deal with a PLT in .ko files in a clang-built kernel. As such, augment the in-kernel linker to support jump table processing. As there is no particular reason to support lazy binding in kernel modules, only implement Secure-PLT immediate binding. As part of these changes, add elf_cpu_parse_dynamic() to the MD API of the in-kernel linker (except on platforms that use raw object files.) The new function will allow MD code to act on MD tags in _DYNAMIC. Use this new function in the PowerPC MD code to ensure BSS-PLT modules using PLT will be rejected during insertion, and to poison the runtime resolver to ensure we get a clear panic reason if a call is made to the resolver. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22608 Notes: svn path=/head/; revision=356053
* Rewrite arm kernel stack unwind code to work when unwinding through modules.Ian Lepore2019-12-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The arm kernel stack unwinder has apparently never been able to unwind when the path of execution leads through a kernel module. There was code that tried to handle modules by looking for the unwind data in them, but it did so by trying to find symbols which have never existed in arm kernel modules. That caused the unwind code to panic, and because part of panic handling calls into the unwind code, that just created a recursion loop. Locating the unwind data in a loaded module requires accessing the Elf section headers to find the SHT_ARM_EXIDX section. For preloaded modules those headers are present in a metadata blob. For dynamically loaded modules, the headers are present only while the loading is in progress; the memory is freed once the module is ready to use. For that reason, there is new code in kern/link_elf.c, wrapped in #ifdef __arm__, to extract the unwind info while the headers are loaded. The values are saved into new fields in the linker_file structure which are also conditional on __arm__. In arm/unwind.c there is new code to locally cache the per-module info needed to find the unwind tables. The local cache is crafted for lockless read access, because the unwind code often needs to run in context where sleeping is not allowed. A large comment block describes the local cache list, so I won't repeat it all here. Notes: svn path=/head/; revision=355780
* Add flags variants to linker_files / stack(9) symbol resolutionConrad Meyer2018-10-201-0/+2
| | | | | | | | | | | | | | | | | | Some best-effort consumers may find trylock behavior for stack(9) symbol resolution acceptable. Expose that behavior to such consumers. This API is ugly. If in the future the modules and linker file list locking is cleaned up such that the linker_files list can be iterated safely without acquiring a sleepable lock, this API should be removed. However, most of the time nothing will be holding the linker files lock exclusive and the acquisition can proceed. Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17620 Notes: svn path=/head/; revision=339463
* Prepare the kernel linker to handle PC-relative ifunc relocations.Mark Johnston2018-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | The boot-time ifunc resolver assumes that it only needs to apply IRELATIVE relocations to PLT entries. With an upcoming optimization, this assumption no longer holds, so add the support required to handle PC-relative relocations targeting GNU_IFUNC symbols. - Provide a custom symbol lookup routine that can be used in early boot. The default lookup routine uses kobj, which is not functional at that point. - Apply all existing relocations during boot rather than filtering IRELATIVE relocations. - Ensure that we continue to apply ifunc relocations in a second pass when loading a kernel module. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16749 Notes: svn path=/head/; revision=338211
* Implement support for ifuncs in the kernel linker.Konstantin Belousov2018-05-031-2/+7
| | | | | | | | | | | | Required MD bits are only provided for x86. Reviewed by: jhb (previous version, as part of the larger patch) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D13838 Notes: svn path=/head/; revision=333228
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326256
* Implement boot-time encryption key passing (keybuf)Allan Jude2017-04-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a general mechanism for providing encryption keys to the kernel from the boot loader. This is intended to enable GELI support at boot time, providing a better mechanism for passing keys to the kernel than environment variables. It is designed to be extensible to other applications, and can easily handle multiple encrypted volumes with different keys. This mechanism is currently used by the pending GELI EFI work. Additionally, this mechanism can potentially be used to interface with GRUB, opening up options for coreboot+GRUB configurations with completely encrypted disks. Another benefit over the existing system is that it does not require re-deriving the user key from the password at each boot stage. Most of this patch was written by Eric McCorkle. It was extended by Allan Jude with a number of minor enhancements and extending the keybuf feature into boot2. GELI user keys are now derived once, in boot2, then passed to the loader, which reuses the key, then passes it to the kernel, where the GELI module destroys the keybuf after decrypting the volumes. Submitted by: Eric McCorkle <eric@metricspace.net> (Original Version) Reviewed by: oshogbo (earlier version), cem (earlier version) MFC after: 3 weeks Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D9575 Notes: svn path=/head/; revision=316343
* kern_linker: Handle module-loading failures in preloaded .ko filesConrad Meyer2016-10-131-0/+1
| | | | | | | | | | | | | The runtime kernel loader, linker_load_file, unloads kernel files that failed to load all of their modules. For consistency, treat preloaded (loader.conf loaded) kernel files in the same way. Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8200 Notes: svn path=/head/; revision=307163
* sys/sys: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | | | While the changes are minor, these headers are very visible. MFC after: 2 weeks Notes: svn path=/head/; revision=298981
* Add a generic firmware dependent handle to pass from the loader to theWarner Losh2015-12-181-0/+1
| | | | | | | | | kernel. This will be used for passing in things like the system table from EFI or other similar metadata that can be used by the kernel to communicate with the firmware. Notes: svn path=/head/; revision=292429
* Add support for weak symbols to the kernel linkers. It means thatKonstantin Belousov2015-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | linkers no longer raise an error when undefined weak symbols are found, but relocate as if the symbol value was 0. Note that we do not repeat the mistake of userspace dynamic linker of making the symbol lookup prefer non-weak symbol definition over the weak one, if both are available. In fact, kernel linker uses the first definition found, and ignores duplicates. Signature of the elf_lookup() and elf_obj_lookup() functions changed to split result/error code and the symbol address returned. Otherwise, it is impossible to return zero address as the symbol value, to MD relocation code. This explains the mechanical changes in elf_machdep.c sources. The powerpc64 R_PPC_JMP_SLOT handler did not checked error from the lookup() call, the patch leaves the code as is (untested). Reported by: glebius Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=288000
* The current limit of 100k for the linker hints file is getting a bitWarner Losh2014-11-291-0/+1
| | | | | | | | | | | crowded as we now are at about 70k. Bump the limit to 1MB instead which is still quite a reasonable limit and allows for future growth of this file and possible future expansion to additional data. MFC After: 2 weeks Notes: svn path=/head/; revision=275261
* Fully support constructors for the purpose of code coverage analysis.Marcel Moolenaar2014-10-201-0/+4
| | | | | | | | | | | | | | | | | | | | This involves: 1. Have the loader pass the start and size of the .ctors section to the kernel in 2 new metadata elements. 2. Have the linker backends look for and record the start and size of the .ctors section in dynamically loaded modules. 3. Have the linker backends call the constructors as part of the final work of initializing preloaded or dynamically loaded modules. Note that LLVM appends the priority of the constructors to the name of the .ctors section. Not so when compiling with GCC. The code currently works for GCC and not for LLVM. Submitted by: Dmitry Mikulin <dmitrym@juniper.net> Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=273334
* Remove some unused fields from struct linker_file. They were added inMark Johnston2013-08-131-4/+0
| | | | | | | | | | r172862 for use by the DTrace SDT framework but don't seem to have ever been used. MFC after: 2 weeks Notes: svn path=/head/; revision=254267
* Provide convenience function for obtaining MODINFO_ADDR and MODINFO_SIZEMarcel Moolenaar2011-02-091-0/+4
| | | | | | | | | | | | | | | | | attributes for preloaded modules/images. In particular, MODINFO_ADDR has the added complexity of not always being relocated properly. Rather than kluging this in the various components that are affected, we handle it in a centralized place (preload_fetch_addr()). To that end, expose a new variable, preload_addr_relocate, that MD initialization code can set and that turns the address attribute into a valid kernel VA. Architectures that need the relocation: arm & powerpc (at least). Components that can utilize this: acpi(4), md(4), fb(4), pci(4), ZFS, geli. Sponsored by: Juniper Networks Notes: svn path=/head/; revision=218494
* Implement a facility for dynamic per-cpu variables.Jeff Roberson2009-06-231-0/+1
| | | | | | | | | | | | | | | | | | - Modules and kernel code alike may use DPCPU_DEFINE(), DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined PCPU_*. Requires only one extra instruction more than PCPU_* and is virtually the same as __thread for builtin and much faster for shared objects. DPCPU variables can be initialized when defined. - Modules are supported by relocating the module's per-cpu linker set over space reserved in the kernel. Modules may fail to load if there is insufficient space available. - Track space available for modules with a one-off extent allocator. Free may block for memory to allocate space for an extent. Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas Notes: svn path=/head/; revision=194784
* Add hooks for the Compact C Type Format (CTF) data to be attached toJohn Birrell2008-05-231-3/+17
| | | | | | | | | the elf files. This is complicated by the fact that the actual CTF parsing has to be done in CDDL'd code, so the BSD licensed code only knows about the opaque data which it must be able to free. Notes: svn path=/head/; revision=179223
* The kernel linker includes a number of utility functions to look up symbolRobert Watson2007-12-011-0/+8
| | | | | | | | | | | | | | | | | | | | information in support of DDB(4); these functions bypass normal linker locking as they may run in contexts where locking is unsafe (such as the kernel debugger). Add a new interface linker_ddb_search_symbol_name(), which looks up a symbol name and offset given an address, and also linker_search_symbol_name() which does the same but *does* follow the locking conventions of the linker. Unlike existing functions, these functions place the name in a caller-provided buffer, which is stable even after linker locks have been released. These functions will be used in upcoming revisions to stack(9) to support kernel stack trace generation in contexts as part of a live, rather than suspended, kernel. Notes: svn path=/head/; revision=174132
* Fix comments.Ruslan Ermilov2007-11-221-3/+3
| | | | Notes: svn path=/head/; revision=173841
* Add a function to list symbols in a file and their values at theJohn Birrell2007-11-181-0/+8
| | | | | | | | same time rather than having to list the symbols and then go back and look each one up by name. Notes: svn path=/head/; revision=173714
* Add the full module path name to the kld_file_stat structureJohn Birrell2007-10-221-0/+26
| | | | | | | | | | | | | | | | | for kldstat(2). This allows libdtrace to determine the exact file from which a kernel module was loaded without having to guess. The kldstat(2) API is versioned with the size of the kld_file_stat structure, so this change creates version 2. Add the pathname to the verbose output of kldstat(8) too. MFC: 3 days Notes: svn path=/head/; revision=172862
* Add a new section in this file for functions that are only exported by theJohn Baldwin2006-06-201-17/+4
| | | | | | | | | linker for use in the linker class handlers. Move linker_add_class(), linker_file_unload(), linker_load_dependencies(), and linker_make_file() into this section. Notes: svn path=/head/; revision=159805
* - Push Giant down into linker_reference_module().John Baldwin2006-06-201-0/+8
| | | | | | | | | | | - Add a new function linker_release_module() as a more intuitive complement to linker_reference_module() that wraps linker_file_unload(). linker_release_module() can either take the module name and version info passed to linker_reference_module() or it can accept the linker file object returned by linker_reference_module(). Notes: svn path=/head/; revision=159804
* Make linker_find_file_by_name() and linker_find_file_by_id() static toJohn Baldwin2006-06-201-10/+0
| | | | | | | | simplify linker locking. The only external consumers now use linker_file_foreach(). Notes: svn path=/head/; revision=159800
* - Add a new linker_file_foreach() function that walks the list of linkerJohn Baldwin2006-06-201-0/+12
| | | | | | | | | | | | | | | | | file objects calling a user-specified predicate function on each object. The iteration terminates either when the entire list has been iterated over or the predicate function returns a non-zero value. linker_file_foreach() returns the value returned by the last invocation of the predicate function. It also accepts a void * context pointer that is passed to the predicate function as well. Using an iterator function avoids exposing linker internals to the rest of the kernel making locking simpler. - Use linker_file_foreach() instead of walking the list of linker files manually to lookup ndis files in ndis(4). - Use linker_file_foreach() to implement linker_hwpmc_list_objects(). Notes: svn path=/head/; revision=159797
* Make linker_file_add_dependency() and linker_load_module() static sinceJohn Baldwin2006-06-201-12/+0
| | | | | | | only the linker uses them. Notes: svn path=/head/; revision=159796
* MFP4: Support for profiling dynamically loaded objects.Joseph Koshy2006-03-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel changes: Inform hwpmc of executable objects brought into the system by kldload() and mmap(), and of their removal by kldunload() and munmap(). A helper function linker_hwpmc_list_objects() has been added to "sys/kern/kern_linker.c" and is used by hwpmc to retrieve the list of currently loaded kernel modules. The unused `MAPPINGCHANGE' event has been deprecated in favour of separate `MAP_IN' and `MAP_OUT' events; this change reduces space wastage in the log. Bump the hwpmc's ABI version to "2.0.00". Teach hwpmc(4) to handle the map change callbacks. Change the default per-cpu sample buffer size to hold 32 samples (up from 16). Increment __FreeBSD_version. libpmc(3) changes: Update libpmc(3) to deal with the new events in the log file; bring the pmclog(3) manual page in sync with the code. pmcstat(8) changes: Introduce new options to pmcstat(8): "-r" (root fs path), "-M" (mapfile name), "-q"/"-v" (verbosity control). Option "-k" now takes a kernel directory as its argument but will also work with the older invocation syntax. Rework string handling in pmcstat(8) to use an opaque type for interned strings. Clean up ELF parsing code and add support for tracking dynamic object mappings reported by a v2.0.00 hwpmc(4). Report statistics at the end of a log conversion run depending on the requested verbosity level. Reviewed by: jhb, dds (kernel parts of an earlier patch) Tested by: gallatin (earlier patch) Notes: svn path=/head/; revision=157144
* Make our ELF64 type definitions match standards. In particular thisMarcel Moolenaar2005-12-181-3/+3
| | | | | | | | | | | | | | | | means: o Remove Elf64_Quarter, o Redefine Elf64_Half to be 16-bit, o Redefine Elf64_Word to be 32-bit, o Add Elf64_Xword and Elf64_Sxword for 64-bit entities, o Use Elf_Size in MI code to abstract the difference between Elf32_Word and Elf64_Word. o Add Elf_Ssize as the signed counterpart of Elf_Size. MFC after: 2 weeks Notes: svn path=/head/; revision=153504
* Add a new module information type MODINFOMD_SHDR that will be usedIan Dowse2004-08-271-0/+1
| | | | | | | | by the loader to pass the section header table from preloaded ELF relocatable modules into the kernel. Notes: svn path=/head/; revision=134363
* Give kldunload a -f(orce) argument.Poul-Henning Kamp2004-07-131-1/+8
| | | | | | | | | | | | | | | | | | | | Add a MOD_QUIESCE event for modules. This should return error (EBUSY) of the module is in use. MOD_UNLOAD should now only fail if it is impossible (as opposed to inconvenient) to unload the module. Valid reasons are memory references into the module which cannot be tracked down and eliminated. When kldunloading, we abandon if MOD_UNLOAD fails, and if -force is not given, MOD_QUIESCE failing will also prevent the unload. For backwards compatibility, we treat EOPNOTSUPP from MOD_QUIESCE as success. Document that modules should return EOPNOTSUPP for unknown events. Notes: svn path=/head/; revision=132117
* Make a small revision to the api between the elf linker core and thePeter Wemm2004-05-161-3/+4
| | | | | | | | | elf_reloc() backends for two reasons. First, to support the possibility of there being two elf linkers in the kernel (eg: amd64), and second, to pass the relocbase explicitly (for relocating .o format kld files). Notes: svn path=/head/; revision=129282
* Slight reorg and added AMD64 support. A couple of the MODINFOMD_* valuesPeter Wemm2003-05-011-0/+14
| | | | | | | | | | | | that were added to sparc64 and later powerpc, really should have been in the MI area. But changing that now with insufficient preperation will just cause too much pain. Move MD_FETCH() to the MI sys/linker.h file to avoid another two copies of it. Notes: svn path=/head/; revision=114373
* Resolve relative relocations in klds before trying to parse the module'sJake Burkholder2003-01-211-0/+1
| | | | | | | | | | | | | | | metadata. This fixes module dependency resolution by the kernel linker on sparc64, where the relocations for the metadata are different than on other architectures; the relative offset is in the addend of an Elf_Rela record instead of the original value of the location being patched. Also fix printf formats in debug code. Submitted by: Hartmut Brandt <brandt@fokus.gmd.de> PR: 46732 Tested on: alpha (obrien), i386, sparc64 Notes: svn path=/head/; revision=109605
* Add two hooks to signal module load and module unload to MD code.Marcel Moolenaar2002-10-191-0/+3
| | | | | | | | | | | | | | | The primary reason for this is to allow MD code to process machine specific attributes, segments or sections in the ELF file and update machine specific state accordingly. An immediate use of this is in the ia64 port where unwind information is updated to allow debugging and tracing in/across modules. Note that this commit does not add the functionality to the ia64 port. See revision 1.9 of ia64/ia64/elf_machdep.c. Validated on: alpha, i386, ia64 Notes: svn path=/head/; revision=105469
* Fix kernel module loading on ia64. Cross-module function callsMarcel Moolenaar2002-10-151-0/+1
| | | | | | | | | | | | | | | were improperly relocated due to faulty logic in lookup_fdesc() in elf_machdep.c. The symbol index (symidx) was bogusly used for load modules other than the one the relocation applied to. This resulted in bogus bindings and consequently runtime failures. The fix is to use the symbol index only for the module being relocated and to use the symbol name for look-ups in the modules in the dependent list. As such, we need a function to return the symbol name given the linker file and symbol index. Notes: svn path=/head/; revision=105147
* Add a workaround for what seems to be confusion between binutils and theJake Burkholder2002-09-271-0/+1
| | | | | | | | | | | | | | sparc v9 ABI. The Elf_Rela records for local symbols appear to already have the symbol's value added in to the addend field, even though the ABI specifies we need to lookup the symbol and add its value too. This breaks text relocations in klds because the symbol's value is added twice, and the resulting address points off into nowhere land, so for now just use the addend. Tested by: rwatson Notes: svn path=/head/; revision=104072
* Make the consumers of the linker_load_file() function useMaxime Henrion2002-08-021-2/+4
| | | | | | | | | | | | | | | | linker_load_module() instead. This fixes a bug where the kernel was unable to properly locate and load a kernel module in vfs_mount() (and probably in the netgraph code as well since it was using the same function). This is because the linker_load_file() does not properly search the module path. Problem found by: peter Reviewed by: peter Thanks to: peter Notes: svn path=/head/; revision=101241
* Don't use the symbol name to lookup the symbol value when we can useMarcel Moolenaar2002-04-251-2/+3
| | | | | | | | | | | | | | | the symbol index defined by the relocation. The elf_lookup() support function is to be used by elf_reloc() when symbol lookups need to be done. The elf_lookup() function operates on the symbol index and will do a symbol name based lookup when such is required, otherwise it uses the symbol index directly. This solves the problem seen on ia64 where the symbol hash table does not contain local symbols and a symbol name based lookup would fail for those symbols. Don't pass the symbol name to elf_reloc(), as it isn't used any more. Notes: svn path=/head/; revision=95410
* Change linker_reference_module() so that it's passed a structBrian Somers2002-04-101-1/+4
| | | | | | | | | | | | | mod_depend * (which may be NULL). The only consumer of this function at the moment is digi_loadmoduledata(), and that passes a NULL mod_depend *. In linker_reference_module(), check to see if we've already got the required module loaded. If we have, bump the reference count and return that, otherwise continue the module search as normal. Notes: svn path=/head/; revision=94321
* Fix a number of misspellings of "dependency" and "dependencies" inIan Dowse2001-11-161-6/+6
| | | | | | | | | | comments and function names. PR: kern/8589 Submitted by: Rajesh Vaidheeswarran <rv@fore.com> Notes: svn path=/head/; revision=86469
* Add the sysctl "kern.function_list", which currently exports allBrian Feldman2001-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | function symbols in the kernel in a list of C strings, with an extra nul-termination at the end. This sysctl requires addition of a new linker operation. Now, linker_file_t's need to respond to "each_function_name" to export their function symbols. Note that the sysctl doesn't currently allow distinguishing multiple symbols with the same name from different modules, but could quite easily without a change to the linker operation. This will be a nicety to have when it can be used. Obtained from: NAI Labs CBOSS project Funded by: DARPA Notes: svn path=/head/; revision=85736
* Implement the long-awaited module->file cache database. A userlandPeter Wemm2001-09-111-0/+2
| | | | | | | | | | tool (kldxref(8)) keeps a cache of what modules and versions are inside what .ko files. I have tested this on both Alpha and i386. Submitted by: bp Notes: svn path=/head/; revision=83321