#
272461 |
|
02-Oct-2014 |
gjb |
Copy stable/10@r272459 to releng/10.1 as part of the 10.1-RELEASE process.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
#
254267 |
|
13-Aug-2013 |
markj |
Remove some unused fields from struct linker_file. They were added in r172862 for use by the DTrace SDT framework but don't seem to have ever been used.
MFC after: 2 weeks
|
#
218494 |
|
09-Feb-2011 |
marcel |
Provide convenience function for obtaining MODINFO_ADDR and MODINFO_SIZE 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
|
#
194784 |
|
23-Jun-2009 |
jeff |
Implement a facility for dynamic per-cpu variables. - 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
|
#
179223 |
|
22-May-2008 |
jb |
Add hooks for the Compact C Type Format (CTF) data to be attached to 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.
|
#
174132 |
|
01-Dec-2007 |
rwatson |
The kernel linker includes a number of utility functions to look up symbol 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.
|
#
173841 |
|
22-Nov-2007 |
ru |
Fix comments.
|
#
173714 |
|
17-Nov-2007 |
jb |
Add a function to list symbols in a file and their values at the same time rather than having to list the symbols and then go back and look each one up by name.
|
#
172862 |
|
22-Oct-2007 |
jb |
Add the full module path name to the kld_file_stat structure 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
|
#
159805 |
|
20-Jun-2006 |
jhb |
Add a new section in this file for functions that are only exported by the 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.
|
#
159804 |
|
20-Jun-2006 |
jhb |
- Push Giant down into linker_reference_module(). - 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().
|
#
159800 |
|
20-Jun-2006 |
jhb |
Make linker_find_file_by_name() and linker_find_file_by_id() static to simplify linker locking. The only external consumers now use linker_file_foreach().
|
#
159797 |
|
20-Jun-2006 |
jhb |
- Add a new linker_file_foreach() function that walks the list of linker 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().
|
#
159796 |
|
20-Jun-2006 |
jhb |
Make linker_file_add_dependency() and linker_load_module() static since only the linker uses them.
|
#
157144 |
|
26-Mar-2006 |
jkoshy |
MFP4: Support for profiling dynamically loaded objects.
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)
|
#
153504 |
|
18-Dec-2005 |
marcel |
Make our ELF64 type definitions match standards. In particular this 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
|
#
134363 |
|
26-Aug-2004 |
iedowse |
Add a new module information type MODINFOMD_SHDR that will be used by the loader to pass the section header table from preloaded ELF relocatable modules into the kernel.
|
#
132117 |
|
13-Jul-2004 |
phk |
Give kldunload a -f(orce) argument.
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.
|
#
129282 |
|
16-May-2004 |
peter |
Make a small revision to the api between the elf linker core and the 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).
|
#
114373 |
|
01-May-2003 |
peter |
Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values 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.
|
#
109605 |
|
21-Jan-2003 |
jake |
Resolve relative relocations in klds before trying to parse the module's 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
|
#
105469 |
|
19-Oct-2002 |
marcel |
Add two hooks to signal module load and module unload to MD code. 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
|
#
105147 |
|
15-Oct-2002 |
marcel |
Fix kernel module loading on ia64. Cross-module function calls 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.
|
#
104072 |
|
27-Sep-2002 |
jake |
Add a workaround for what seems to be confusion between binutils and the 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
|
#
101241 |
|
02-Aug-2002 |
mux |
Make the consumers of the linker_load_file() function use 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
|
#
95410 |
|
24-Apr-2002 |
marcel |
Don't use the symbol name to lookup the symbol value when we can use 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.
|
#
94321 |
|
09-Apr-2002 |
brian |
Change linker_reference_module() so that it's passed a struct 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.
|
#
86469 |
|
16-Nov-2001 |
iedowse |
Fix a number of misspellings of "dependency" and "dependencies" in comments and function names.
PR: kern/8589 Submitted by: Rajesh Vaidheeswarran <rv@fore.com>
|
#
85736 |
|
30-Oct-2001 |
green |
Add the sysctl "kern.function_list", which currently exports all 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
|
#
83321 |
|
10-Sep-2001 |
peter |
Implement the long-awaited module->file cache database. A userland 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
|
#
78413 |
|
18-Jun-2001 |
brian |
Add linker_reference_module().
This function loads a module if required, otherwise bumps the reference count -- the opposite of linker_file_unload().
|
#
78161 |
|
13-Jun-2001 |
peter |
With this commit, I hereby pronounce gensetdefs past its use-by date.
Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation.
The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it).
The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *.
For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's.
For a.out, we use the old linker_set struct.
NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas.
The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use.
linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day.
Reviewed by: eivind
|
#
66719 |
|
06-Oct-2000 |
jhb |
Correct a warning where the r_debug_state() dummy function used to trigger a breakpoint in the kernel didn't use the proper argument list. To avoid having to include the userland link.h header everyhwere that sys/linker.h is used, make r_debug_state() a static function in link_elf.c as well.
|
#
63858 |
|
25-Jul-2000 |
jhb |
style(9)'ify all the function prototypes by protecting all the parameter names with a leading underscore. Notably, the 'stat' parameter in the kld_stat() prototype conflicted with stat() and generated a BDE warning.
Approved by: peter
|
#
60938 |
|
26-May-2000 |
jake |
Back out the previous change to the queue(3) interface. It was not discussed and should probably not happen.
Requested by: msmith and others
|
#
60833 |
|
23-May-2000 |
jake |
Change the way that the queue(3) structures are declared; don't assume that the type argument to *_HEAD and *_ENTRY is a struct.
Suggested by: phk Reviewed by: phk Approved by: mdodd
|
#
59751 |
|
29-Apr-2000 |
peter |
First round implementation of a fine grain enhanced module to module version dependency system. This isn't quite finished, but it is at a useful stage to do a functional checkpoint.
Highlights: - version and dependency metadata is gathered via linker sets, so things are handled the same for static kernels and code built to live in a kld. - The dependencies are at module level (versus at file level). - Dependencies determine kld symbol search order - this means that you cannot link against symbols in another file unless you depend on it. This is so that you cannot accidently unload the target out from underneath the ones referencing it. - It is flexible enough that we can put tags in #include files and macros so that we can get decent hooks for enforcing recompiles on incompatable ABI changes. eg: if we change struct proc, we could force a recompile for all kld's that reference the proc struct. - Tangled dependency references at boot time are sorted. Files are relocated once all their dependencies are already relocated.
Caveats: - Loader support is incomplete, but has been worked on seperately. - Actual enforcement of the version number tags is not active yet - just the module dependencies are live. The actual structure of versioning hasn't been agreed on yet. (eg: major.minor, or whatever) - There is some backwards compatability for old modules without metadata but I'm not sure how good it is.
This is based on work originally done by Boris Popov (bp@freebsd.org), but I'm not sure he'd recognize much of it now. Don't blame him. :-) Also, ideas have been borrowed from Mike Smith.
|
#
59603 |
|
24-Apr-2000 |
dfr |
* Rewrite to use kobj(9) instead of hard-coded function tables. * Report link errors to stdout with uprintf() so that the user can see what went wrong (PR kern/9214). * Add support code to allow module symbols to be loaded into GDB using the debugger's "sharedlibrary" command.
|
#
55205 |
|
29-Dec-1999 |
peter |
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
44572 |
|
08-Mar-1999 |
dcs |
Add MODINFO_ARGS, parameters passed to a module at load time.
VS: ----------------------------------------------------------------------
|
#
43309 |
|
27-Jan-1999 |
dillon |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile.
This commit includes significant work to proper handle const arguments for the DDB symbol routines.
|
#
43301 |
|
27-Jan-1999 |
dillon |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile
|
#
43185 |
|
25-Jan-1999 |
dfr |
Don't try to call SYSUNINIT functions if there was a link error.
Reviewed by: Peter Wemm <peter@netplex.com.au>
|
#
41090 |
|
11-Nov-1998 |
peter |
kldsym(2) prototype implementation
|
#
40906 |
|
04-Nov-1998 |
peter |
The handle for the kernel is common. With this fix, ELF kernels can load a.out kld modules, and a.out kernels can load ELF kld modules.
|
#
40435 |
|
16-Oct-1998 |
peter |
*gulp*. Jordan specifically OK'ed this..
This is the bulk of the support for doing kld modules. Two linker_sets were replaced by SYSINIT()'s. VFS's and exec handlers are self registered. kld is now a superset of lkm. I have converted most of them, they will follow as a seperate commit as samples. This all still works as a static a.out kernel using LKM's.
|
#
40138 |
|
09-Oct-1998 |
peter |
Debug typo fixes. Change symbol_values return type to int, on the chance that we've been given the wrong symbol table. Symbols have a string index that must be relative to the correct string table. Add prototypes for better kld support for ddb.
|
#
40104 |
|
09-Oct-1998 |
msmith |
MODINFO_NAME can't be 0, that's the end of the metadata area.
|
#
40096 |
|
08-Oct-1998 |
msmith |
Missing defines for the kernel environment and module metadata lookup functions
|
#
39179 |
|
14-Sep-1998 |
msmith |
Add constants associated with preloaded kernel modules.
|
#
38275 |
|
12-Aug-1998 |
dfr |
Modify the internal interfaces to the kernel linker to make it possible for DDB to use its symbol tables.
|
#
32152 |
|
01-Jan-1998 |
bde |
Use a real malloc type for M_LINKER instead of #defining it as M_TEMP.
|
#
31324 |
|
20-Nov-1997 |
bde |
Fixed a sloppy common-style definitions.
|
#
25537 |
|
07-May-1997 |
dfr |
This is the kernel linker. To use it, you will first need to apply the patches in freefall:/home/dfr/ld.diffs to your ld sources and set BINFORMAT to aoutkld when linking the kernel.
Library changes and userland utilities will appear in a later commit.
|