summaryrefslogtreecommitdiffstats
path: root/sys/kern/link_elf_obj.c
Commit message (Collapse)AuthorAgeFilesLines
* The ia64 kernel is now linked dynamically so parse its _DYNAMIC structure.dfr2001-09-151-4/+0
|
* KSE Milestone 2julian2001-09-121-9/+10
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Fix a warning. l_name is managed by us and is malloc/free'ed.peter2001-09-101-1/+1
| | | | It is the userland declaration of l_name that is inconvenient for us.
* Unindent a if (1) { that was left behind in the last commit.peter2001-09-031-46/+44
| | | | (commits were seperated to not obscure the real change)
* Argh. Make the ia64 kernel work in all situations. For some reason,peter2001-09-031-4/+3
| | | | | | | and I still dont know why, this was not failing on the non-kse kernel. It certainly should have since things were using linker_kernel_file unconditionally. This has highlighted a different problem though that means that trying to do a kldload on a non-dynamic kernel will implode.
* Fix some of the GDB linkage setup. The l_name member of the gdb linkagewpaul2001-08-101-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | structure is always free()ed yet only sometimes malloc()ed. In particular, it was simply set to point to l_filename from the a linker_file_t in link_elf_link_preload_finish(). The l_filename had been malloc()ed inside the kern_linker.c module and was being free()ed twice: once by link_elf_unload_file() and again by linker_file_unload(), leading to a panic. How to duplicate the problem: - Pre-load a kernel module from the loader, i.e. if_sis.ko - Boot system - Attempt to unload module with kldunload if_sis - Bewm The problem here is that the case where the module was loaded with kldload after system boot would work correctly, so this bug went unnoticed until I stubbed my toe on it just now. (Also, you can only trip this bug if you compile a kernel with options DDB, but that's the default now.) Fix: remember to malloc() a separate copy of the module name for the l_name member of the gdb linkage structure in three places where the linkage structure can be initialized.
* Previously, the ELF linker would always just store the pointer to agreen2001-08-061-1/+5
| | | | | | | | | | | | filename passed in via the module loader functions in the GDB "sharedlibrary" support structures. This isn't good, since the pointer would become stale in almost every case (not the pre-loaded case, of course). Change this to malloc()ed copy of the string and finally fix the reason that gdb -k's "sharedlibrary" command stopped working. Obtained from: LOMAC/FreeBSD (cf. NAI Labs)
* Use a machine dependent type, Elf_Hashelt, for the elements of the elfjake2001-07-311-5/+5
| | | | | | | | dynamic symbol table buckets and chains. The sparc64 toolchain uses 32 bit .hash entries, unlike other 64 bits architectures (alpha), which use 64 bit entries. Discussed with: dfr, jdp
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-041-8/+2
| | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
* With this commit, I hereby pronounce gensetdefs past its use-by date.peter2001-06-131-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Include sys/mutex.h to silence a warning.dd2001-06-031-0/+1
|
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-0/+8
| | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-2/+4
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Make this compile in a.out mode. link.h has extra dependencies for a.out.peter2001-02-251-0/+3
|
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-2/+1
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Correct a warning where the r_debug_state() dummy function used to triggerjhb2000-10-061-3/+6
| | | | | | 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.
* Don't support dynamic linking on ia64 for now - the tools can't cope.dfr2000-09-291-0/+6
|
* Ignore ELF files with 'interpreter' section because KLDs doesn't contain it.bp2000-09-061-0/+5
| | | | Reviewed by: peter
* Move the truncation code out of vn_open and into the open system callmckusick2000-07-041-2/+3
| | | | | | | | | | after the acquisition of any advisory locks. This fix corrects a case in which a process tries to open a file with a non-blocking exclusive lock. Even if it fails to get the lock it would still truncate the file even though its open failed. With this change, the truncation is done only after the lock is successfully acquired. Obtained from: BSD/OS
* Remove unneeded #include <vm/vm_zone.h>phk2000-04-301-1/+0
| | | | Generated by: src/tools/tools/kerninclude
* First round implementation of a fine grain enhanced module to modulepeter2000-04-291-77/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Do not use uprintf() for link time error messages. This has unpleasantpeter2000-04-291-4/+4
| | | | | consequences when it happens in the preload support, before curproc or the tty system exist.
* * Rewrite to use kobj(9) instead of hard-coded function tables.dfr2000-04-241-137/+224
| | | | | | | * 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.
* Fixed a cast of a pointer to an integer of a possibly different size.bde1999-12-241-3/+3
| | | | | Fixed casts of non-`void *' pointers to uintptr_t. Fixed related style bugs. This file uses perfectly non-KNF formatting for casts.
* Introduce NDFREE (and remove VOP_ABORTOP)eivind1999-12-151-2/+2
|
* Fix an embarresing mistake in the kld symbol lookup for DDB. It shouldpeter1999-11-281-4/+6
| | | | | | | now correctly do a traceback when crashing inside a KLD module. PR: 15014 Submitted by: Vladimir N. Silyaev <vns@delta.odessa.ua>
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-0/+4
| | | | Submitted by: phk
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Cast pointers to uintptr_t instead of casting them to u_long, and/or vicebde1999-08-241-3/+3
| | | | versa. Cosmetic.
* Use KERNBASE for the load address of the kernel rather than magic constantspeter1999-05-081-7/+2
| | | | as it seems to work.. (at least on i386/elf).
* Cast to `const char *' instead of to c_caddr_t. This is part ofbde1999-01-291-5/+5
| | | | | | terminating c_caddr_t with extreme prejudice. Here we depended on the "opaque" type c_caddr_t being precisely `const char *' to do unportable pointer arithmetic.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-2/+2
| | | | kernel compile
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-3/+3
| | | | | | | kernel compile. This commit includes significant work to proper handle const arguments for the DDB symbol routines.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-12/+12
| | | | kernel compile
* Don't try to call SYSUNINIT functions if there was a link error.dfr1999-01-251-1/+5
| | | | Reviewed by: Peter Wemm <peter@netplex.com.au>
* When loading something that has undefined symbols, it would be helpful topeter1998-12-311-5/+13
| | | | know what they were..
* Don't put aggregate structs 4K large on the kernel stack, especially whenpeter1998-11-061-23/+30
| | | | | | | | | | we can recurse when loading dependencies and that the kstack is limited to something like 6 or 7KB. Having a single dependency caused an instant double panic, and I stronly suspect some of the other strange "events" that I have seen are possibly as a result of taking a couple of interrupts with a large chunk of the stack already in use. While here, fix a minor logic hiccup in a sanity check.
* The handle for the kernel is common. With this fix, ELF kernels can loadpeter1998-11-041-11/+5
| | | | a.out kld modules, and a.out kernels can load ELF kld modules.
* Nitpicking and dusting performed on a train. Removes trivial warningsphk1998-10-251-12/+1
| | | | about unused variables, labels and other lint.
* *gulp*. Jordan specifically OK'ed this..peter1998-10-161-30/+41
| | | | | | | | 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.
* - bzero() after malloc() bug fixpeter1998-10-151-6/+7
| | | | | - look up relocation symbol names in correct table bugfix. - remove unused (initialized to 0) variable and conditional free() of it.
* Load the full symbol tables if they are present. This means that ddbpeter1998-10-131-10/+78
| | | | | and tracebacks have access to local symbols. This is particularly important for the Alpha.
* Only print kernel entry point during load.peter1998-10-121-21/+108
| | | | | | | | | | | | | | | | | | | Drastically quieten down the verbose load progress messages. They were more useful for debugging than anything, but are beyond a joke when loading a few dozen modules. Simplify the ELF extended symbol table load format. Just take the main symbol table and the string table that corresponds. This is what we will be getting local symbols from. (needed for the alpha stack tracebacks). Use the (optional) full symbol tables in lookups. This means we have to furhter distinguish between symbols that can come from the dynamic linking table and the complete table. The alpha boot code now needs to be adapted as ddb/db_elf.c cannot use the simpler format. I have not implemented loading the extended symbol tables from the syscall interface yet, just for preloaded modules. I am not sure about the symbol resolution. I *think* it's possible that a local symbol can be found in preference to a global, depending on the search sequence and dependency tree.
* Fully implement KLD and preloading.peter1998-10-091-53/+142
| | | | | | | | | | | | | | - seperate unload for preloaded linker objects. - Don't build a kernel object if running as an a.out kernel. - extract the real kernel name rather than hardwiring "kernel" for kldstat. (sysctl kern.bootfile getst the full name via bootinfo) - use real addresses on the kernel "module" rather than fictitious ones. - preloaded module support - search module path for file modules. - symbols are checked to see if they are in the right containing file before using their indexes into string tables. This is to help ddb since it only supplies a pointer to an opaque symbol and there is no telling which file/object/module/whatever it came from.
* Implement dynamic loading for ELF.dfr1998-09-111-186/+410
|
* Add partial KLD support for ELF. The module loading is not written yet.dfr1998-08-241-0/+503
OpenPOWER on IntegriCloud