#
43d1a0dc |
|
21-Mar-2024 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: Implement DT_RUNPATH DT_RUNPATH is generated by the linker instead of DT_RPATH when using --enable-new-dtags It seems to be the default when using ld.lld Normally one difference is LD_LIBRARY_PATH is checked before DT_RUNPATH (and not with DT_RPATH), but we don't check LD_LIBRARY_PATH at the moment. Checking LIBRARY_PATH isn't an option, because runtime_loader dosesn't use default paths, test suites would define LIBRARY_PATH empty. Tested with tcpdump build_matrix.sh script, with clang 17, local libpcap, which requires --disable-new-dtags on r1beta4. Change-Id: Iacccde8d20e25ad14c5c548dd8832ea32b67e228 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7539 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
ad59349e |
|
27-Dec-2022 |
X512 <danger_mail@list.ru> |
runtime_loader: dequeue disposable image before calling image finalizers Fix #18181. Change-Id: I2e86d72eb2b32b807364fb45126080540e62dcdf Reviewed-on: https://review.haiku-os.org/c/haiku/+/5970 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
|
#
b2b83ad1 |
|
14-Mar-2021 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: dlopen() should respect RPATH of the loading module Change-Id: Ic58edb53114dfff30cc7188957cd32508fa8bd48 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3798 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
58dcc29b |
|
01-Mar-2020 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Fix memory leak in init_dependencies. get_sorted_image_list allocates initList even if "count" winds up being 0, so we need to free it in this case also. Spotted by Coverity.
|
#
5d08e3a5 |
|
17-Feb-2020 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Combine and correct term function invocations. In d49942867bbeb4ce3c4c89c0224fc4c828452f67 (part of hrev52813), I moved invocation of the TERM_BEFORE/TERM_AFTER functions to runtime_loader. Unfortunately, I only updated one location where they should be invoked, and runtime_loader had two. After this commit, there is one function that they are called from, which is itself invoked from the appropriate places. Noted by ttcoder & mmlr in #14047.
|
#
40b0fbbb |
|
10-Aug-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Set B_CLONEABLE_AREA on the debug area. The debug_server uses it for symbol lookup.
|
#
dee722ce |
|
18-May-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Optimize a special case of get_nearest_symbol. If the caller does not want the symbol name/address/etc., we don't need to spend the time finding it, and can just return after finding the image. Change-Id: I138f8bd4071ffc25738dac4d6c0c6d3fe25edf1c Reviewed-on: https://review.haiku-os.org/c/1461 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
|
#
35fa85db |
|
14-Mar-2019 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: load "LD_PRELOAD" libraries after the executable. This makes the behavior more standard, is still to be used with libroot_debug.so for instance. The old behavior is obtained with "LD_PRELOAD_ADDONS"; in fact a runtime_loader add-on needs to be entirely loaded before the executable to be effective. To be used with libltrace_stub.so for instance. Change-Id: I8536c5b8873f975405bea9eb4e2b92febabfc78a Reviewed-on: https://review.haiku-os.org/c/1409 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
3a75ef9a |
|
10-Mar-2019 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: call preinit_array before initializing dependencies. Change-Id: Ieed1af8ede83692d583d8e84bae92b1be29ddd1e Reviewed-on: https://review.haiku-os.org/c/1187 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
f167d21a |
|
11-Feb-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Use a RecursiveLocker instead of manually unlocking. No functional change intended.
|
#
354b60af |
|
26-Jan-2019 |
Augustin Cavalier <waddlesplash@gmail.com> |
runtime_loader: Rework static initialization handling. Previously, static initializers were just in ".ctors", which was handled by GCC's crtbeginS, and that was injected in-between crti and crtn. Now, however, binutils puts static initializers into init_array/fini_array by default, which runtime_loader handles, but of course as initialize_after and terminate_after are supposed to be called *after* all static initializers are called; and since runtime_loader called init_array after _init, they were not. Now, we get rid of the __haiku_init_before/etc. functions, and move their functionality inside runtime_loader. This is a "soft" ABI breakage, which is mitigated by adding another ABI breakage (runtime_loader now returns NULL for the initialize_before/etc. symbols, as otherwise old applications would have their initialize_before/etc. called twice; once by runtime_loader, and then once by __haiku_init_before/etc.) I don't see or know of any reason why an application would want to get those symbols at runtime, though, so this shouldn't have any adverse effects. Change-Id: I42344c63f69c6f8ef260f6c3ca30202b6dfb153e Reviewed-on: https://review.haiku-os.org/c/907 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
2aaad308 |
|
02-May-2018 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: enable elf32 on x86_64, elf64 on x86. use x86 as default sSearchPathSubDir in compatibility mode. use the generic memset/memcpy when x86_64 is the primary arch. Change-Id: Ib464c308ff97f7ae2482ef4c037de1b1bb2bf61b
|
#
e340f717 |
|
11-Oct-2016 |
Jérôme Duval <jerome.duval@gmail.com> |
runtime_loader: add support for ELF init/term routine arrays. * binutils 2.27 defaults to DT_INIT_ARRAY instead of DT_INIT.
|
#
ebdc1d48 |
|
11-Apr-2015 |
Michael Lotz <mmlr@mlotz.ch> |
runtime_loader: Add imageName and exactMatch to symbol lookup. Extend the get_nearest_symbol_at_address() private runtime_loader export to include imageName and exactMatch arguments. The imageName holds the SONAME of the image, if available, so cannot neccessarily be extracted from the image path. Whether or not there was an exact match, i.e. the symbol with its size contains the address, is now returned in exactMatch.
|
#
44c0c4d3 |
|
03-May-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
runtime_loader: add support for ELF based TLS This patch introduces support of ELF based TLS handling with lazy allocation and initalization of TLS block for each DSO and thread. The implementation generally follows the official ABI except that generation counter in dtv is in fact a pointer to Generation object that contains both generation counter and size of the dtv. That simplified the implementation a bit, but could be changed later. The ABI requirements regariding in memory position of TLS block is not honoured what results in static TLS model being unsupported. However, that should not be a problem as long as "executables" in Haiku are in fact shared objects and optimizations which require specific TLS block in memory layout are not possible anyway.
|
#
8d23c440 |
|
26-Nov-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
runtime loader: Add support for $ORIGIN in rpath Like in Linux it resolves to the directory of the shared object whose needed library is to be loaded.
|
#
ded25be1 |
|
03-Oct-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
runtime loader: 64-bit ktrace output fixes
|
#
9f3bd497 |
|
15-Apr-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
runtime_loader: explicitly randomize rld_heap and _rld_debug_ positions
|
#
e3ac2588 |
|
25-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Changed runtime_loader to use elf_* typedefs over Elf32_*. This means that it will be using ELF64 types on x86_64 rather than ELF32. The next step for supporting x86_64 is to implement relocations.
|
#
43e7b1c2 |
|
31-Mar-2012 |
Hamish Morrison <hamish@lavabit.com> |
Fix dladdr behaviour * If dladdr can't find an exact match, it returns the nearest symbol less than the given address. * If no suitable symbol can be found, but the address is within a loaded library, dladdr returns the library name and base address. Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>
|
#
b6455c08 |
|
07-Aug-2011 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented dladdr() in the runtime loader. This is like a gazillion times faster than before. * This also solves a TODO in dladdr(), although I did not use get_library_symbol() as I didn't quite see how that could fit as the comment suggested; there is now a new function get_symbol_at_address() for this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42598 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
25dc253d |
|
22-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Merged weak-symbols branch. * Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp * Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
aa3507fe |
|
04-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
terminate_program(): Call the termination function of all images, not only of the program image and its transitive dependencies. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39306 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d64f6189 |
|
04-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
unload_library(): Added comment about the exit hook handling. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39299 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f7127458 |
|
15-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Private libroot locking primitives: - Reimplemented mutex to use the _kern_mutex*() syscalls. - The initializer functions cannot fail anymore -- changed their return type to void. - Changed the initializer function semantics to not copy the name by default anymore (as in the kernel). Also added *_etc() versions of them that take an additional flags. - Added static initializer macros. - Made the mutex (and thus recursive_lock) lock functions non-interruptable. - Got rid of the "lazy" version. They are no longer needed, since the initialization of the standard types can be done statically and cannot fail. * Adjusted libroot, runtime loader, and other code using the private libroot locking primitives to the new semantics. * pthreads mutexes and condition variables: - Reimplemented using the _kern_mutex*() syscalls. - Consistently use POSIX error codes. - Fixed some not quite POSIX compliant behavior. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4f339c2c |
|
19-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
preload_image(): Removed erroneous rld_unlock() in error case. Fixes #5599. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35919 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
765a039d |
|
27-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Pre-load shared objects as libraries, so their symbols will be used automatically and a pre-loaded library will not be loaded again, when it's also a dependency. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34786 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f2bb2575 |
|
29-Nov-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Use the shared recursive lock implementation instead of the home-grown stuff. The shared implementation is benaphore style, saving unnecessary syscalls. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34338 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c533f813 |
|
27-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Normalized the FATAL messages. The image path is always printed, now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30878 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
94830eb2 |
|
20-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved most code of the heavy elf.cpp into several smaller source files. * Some style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
003ebb0e |
|
19-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Also define the build system variables TARGET_STATIC_{LIBSTDC++,LIBSUPC++}. * runtime loader: - Fixed gcc 4 warnings. - Enabled -Werror. - Renamed all remaining *.c source files to *.cpp. - Implemented GNU style ELF symbol versioning support. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30806 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f91194e5 |
|
13-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Removed the gcc_version from the runtime loader's image_t. Instead we always determine (or guess) Haiku version and ABI and use those for compatibility decisions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30747 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
593ee7bb |
|
12-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Extended image_info by fields for the Haiku version and ABI. The runtime loader and the kernel read those values from the shared object (if available). In the runtime loader this should eventually replace the gcc version guessing method currently used (at least for shared objects built for Haiku). The optional packages need to be rebuilt first, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30729 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2ecebae1 |
|
09-Apr-2009 |
David McPaul <dlmcpaul@gmail.com> |
ignore Stack type in elf loader git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30099 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a2dad9e1 |
|
21-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
get_library_symbol(): Simplified the RTLD_NEXT case. The caller is not bound to search for a function with the same name as the calling function, so we really don't need to find the calling function; the calling image suffices. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29645 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e94d1bad |
|
14-Mar-2009 |
Michael Lotz <mmlr@mlotz.ch> |
Add the name of the missing symbol to the error message that is sent via port. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29515 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
80ece785 |
|
28-Feb-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added private get_image_symbol_etc() that can recursively search for a symbol (similar to how dlsym() works). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29356 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
47bc6663 |
|
01-Feb-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The assumption that the program image is not used for relocation of dlopen()ed objects was incorrect. This should fix problems with ports of software with a plugin/add-on interface. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29112 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
df30098d |
|
09-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
unload_library() invoked from dlclose() might not have deleted images correctly and it returned an error on success. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28578 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0c85bd05 |
|
08-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Reworked undefined symbol resolution in the runtime loader. Got rid of the per-root-image breadth-first sorted image array. Instead we have a per-image hook function to resolve the symbols. The default function uses the sLoadedImages list directly, which is breadth-first sorted anyway. There's also a BeOS function for old-style symbol resolution and one for add-ons, which lacks a proper implementation yet (just uses old-style ATM). * Made the dl*() functions POSIX compliant: - dlopen() does no longer use load_add_on(), but loads the object as a library. It also properly supports a NULL name, now -- the previous "_APP_" work-around did only work, if this soname was set on the program (unlikely for programs using this API). - Implemented RTLD_{GLOBAL,LOCAL}. - dlsym() looks up symbols properly now, i.e. not just in the given image, but breadth-first for an actual image or in load order for the global scope. It also supports the not-quite POSIX RTLD_DEFAULT and RTLD_NEXT extensions. Our RTLD_NEXT finds more symbols than in Linux (also in later dlopen()ed libraries), but that should be fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28568 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10b4b5d1 |
|
03-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added an "add-on" interface for the runtime loader. Pre-loaded images can export a structure containing callback hooks invoked by the runtime loader when certain image events occur (image loaded, relocated, initialized, etc.). * Also added a mechanism to patch image symbols. For an image callback functions can be installed that patch symbols exported or imported by the image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28475 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca618b22 |
|
01-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed the way symbols are resolved. For each root image (program, add-on) we create a breadth-first sorted image list and use that to search for symbols. * Added support for preloading libraries. The environment variable LD_PRELOAD can contain a whitespace-separated list of shared objects that will be loaded before the program. This allows to replace symbols without changing the executable or libraries. * Resolved TODO in load_program() regarding the order of remapping the images and initializing the dependencies (problem fixed in r28453). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28455 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
02e577f9 |
|
22-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
When going to load a library also check whether the last path component matches the program's image name. This is a special case for add-ons that link against the application, with the application not having a soname set. The concerned Pe add-ons (HeaderHeader and others) work now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28294 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b2568a30 |
|
20-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by romain: Fixed FD leak after opening an image that has already been loaded. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28246 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
85f9771a |
|
11-Oct-2008 |
François Revol <revol@free.fr> |
Avoid crashing if gccPlatform is NULL, thanks Axel! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27968 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2716cfd3 |
|
10-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Threw away the broken stat() vs. _stat() mechanism to allow for more fields in struct stat. * Instead, I followed Marcus' great idea and added a compatibility check in the runtime loader: now, R5 binaries (also shared libraries) are detected, and they get special versions for stat(), fstat(), and lstat() that return the smaller stat struct. * However, I've disabled (in src/system/libroot/posix/sys/stat.c) using the larger stat field for now, as this breaks some of our optional packages. So until we rebuild them all, this shouldn't be enabled. * This should now also be used for BeOS compatibility in libnetwork.so. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27961 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0555803a |
|
06-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Applied patch by Romain, thanks!: * get_nth_symbol() did not correctly iterate over the symbol hash, causing it to return the same symbols more than once, and omit others. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27896 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e73923b0 |
|
18-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed static recursive lock variables to match our coding style guidelines. * Renamed runtime loader semphore to something clearer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27623 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9a6072a3 |
|
18-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Resolved TODO added by Ingo: the runtime loader now lazily updates its image IDs when needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27611 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cbc456de |
|
17-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added TODO regarding updating the image ID's after fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27604 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
320bd2bd |
|
18-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* More specific error message when relocating fails. * Whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27031 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2a33a944 |
|
03-Jun-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Don't spam to the standard output when not finding a symbol. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25784 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
61b37794 |
|
17-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added explicit support for loading executables compiled with the respectively other gcc version on a Haiku compiled with gcc 2 or gcc 4. The libraries for such an executable are first searched in "gcc4" respectively "gcc2" subdirectories of the standard search path directories. If not found there, we try again with the standard paths. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25532 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6b202f4e |
|
13-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced new header directory headers/private/system which is supposed to contain headers shared by kernel and userland (mainly libroot). * Moved quite a few private kernel headers to the new location. Split several kernel headers into a shared part and one that is still kernel private. Adjusted all affected Jamfiles and source in the standard x86 build accordingly. The build for other architectures and for test code may be broken. * Quite a bit of userland code still includes private kernel headers. Mostly those are <util/*> headers. The ones that aren't strictly kernel-only should be moved to some other place (maybe headers/private/shared/util). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5d0638bf |
|
10-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed FATAL macro to always dprintf() the error. Additionally it still prints to stdout, but only until the program and its dependencies are loaded. Failed attempts to load add-ons and the like doesn't pollute stdout anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25437 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6bf15ffc |
|
27-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed macros that enable tracing for individual components from defined/undefined to numeric values (0 for undefined). This allows for trace levels. * Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is what one usually wants. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3cf7ecd1 |
|
13-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added <sys/mman.h> header. It declares only mmap() and munmap() yet and defines the macros needed by them. * Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the path to an FD parameter. Changed vm_map_file() accordingly and adjusted the kernel ELF loader and the runtime loader. * Added syscall _kern_unmap_memory(). * Added bool unmapAddressRange parameter to vm_create_anonymous_area() and map_backing_store(). If true and the address specification is B_EXACT_ADDRESS, all areas in the specified address range will be deleted (unless an area is covered only partially). * Introduced B_SHARED_AREA flag, which is set on areas that have been created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When fork()ing those areas won't be copied CoW, but rather be cloned. This is needed for mmap() MAP_SHARED. * {vm,_user}_map_file() also accept an FD argument < 0, in which case an anonymous area is created. * Implemented mmap() and munmap(). Currently there's the restriction that we can't partially unmap areas. Otherwise the functions should be rather compliant. We also support the non-POSIX extension MAP_ANONYMOUS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
071f9c3a |
|
27-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Build configurations shouldn't be done in svn controlled files, so I finally created a solution to avoid that: Header files that contain configuration settings (and nothing else) go to build/config_headers. To change settings, create a directory build/user_config_headers (which is ignored by svn), copy the respective header there and modify it at your leisure. Currently only tracing_config.h has been moved to the new location, but more files will follow eventually. It is also recommended to move optional macro definitions in Jamfile (as for BFS) to a config header instead; the build system will then automatically rebuild on changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24611 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
92af28df |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Turned the note into a TODO, adding a thought how to implement it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24546 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5fd6637b |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Decide whether to use BeOS style symbol resolution at run time depending on the gcc version of the executable. * Adjusted non-BeOS-style symbol resolution so that add-ons and dynamically loaded libraries find symbols in the executable. This change re-enables support for undefined symbols. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24537 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
34982809 |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The runtime loader now reads a part of the .comment section of each shared object to find out the GCC version it has been compiled with. This is not an exact science, since we've got the version string for every single object file that has been linked in, but my heuristic seems to be good enough. Having the gcc version at hand will allow for two features: Enabling work-arounds for old executables (like the type info problem in BeOS apps), and automatically selecting the right set of libraries in a mixed gcc 2/gcc 4 environment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24534 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
dd76bc97 |
|
19-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed NULL related warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24484 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
12a5e9a4 |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
bonefish+axeld: The runtime loader did not correctly resolve %A correctly with the actual normalized program path. IOW it would not work correctly with symlinks to applications that had their own lib directory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23986 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6918dbf4 |
|
07-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Normalize the given image path in load_container(). Just constructing some absolute path was not enough to always recognize a library as already loaded. This fixes problems with Perl where loading an add-on would cause another instance of libperl.so to be loaded, which would lead to crashes due to uninitialized static vars in the new instance. Perl builds now and the tests run, but quite a few do fail. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23930 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7486b72d |
|
07-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added some kernel tracing to the runtime loader. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23921 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3be509a2 |
|
13-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
Fix the static cleanup mechanism introduced to the runtime_loader/libroot: * Fixed wrong start and size used in the runtime_loader * Fixed off by one error in the matching loop of the cleanup hook * Make sure we successfully acquire the locking sem of the exit stack git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23493 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c2a9d74 |
|
12-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
bonefish+mmlr: As (our) gcc unfortunately uses atexit() to clean up lazily initialized static variables inside functions we have to ensure that we do the right thing with unloadable shared objects. In case a shared object was unloaded that installed an atexit() hook the application would crash on exit. We now implement a callback into libroot that is used to call all the atexit() hooks of a component that is to be unloaded. Most prominently this fixes the media_server crash at shutdown. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23486 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2760c4cd |
|
02-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* load_program() (and probably others) could call delete_image() with a NULL pointer - which it now handles gracefully. * This also fixes starting the runtime loader directly: it no longer crashes but will just return an error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22409 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5aa7b7b6 |
|
27-Sep-2007 |
Marcus Overhagen <marcusoverhagen@gmail.com> |
Fix broken build and the compiler warning "enumeral mismatch in conditional expression". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22332 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1873b4b3 |
|
10-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Give the runtime loader a chance to reinit its semaphore after fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21886 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4bef3723 |
|
29-Jul-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* Followed Ingo's suggestion and send the message manually in the runtime loader; therefore, we could remove the ugly defines from KMessage again, and compile it with KMESSAGE_CONTAINER_ONLY. * Added KMessage::SetDeliveryInfo() to be able to send messages with a correct header. * Fixed a bug in KMessage::SendTo() that would not send the senderTeam when passing a negative value for the parameter, but override it when passing in a valid value. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21740 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
74c0424a |
|
26-Jul-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a mechanism to retrieve a BMessage with eventual error descriptions for _kern_load_image(). * Added KMessage to the runtime_loader (a bit hacky, though) - it will use it to deliver the above mentioned functionality. * load_dependencies() did return the wrong status code in case a library was missing; now it returns B_MISSING_LIBRARY. * load_dependencies() will now try to load all dependencies when a report message is requested; therefore, all missing libraries are listed. * Renamed uspace_program_args to user_space_program_args. * The kernel filled in various members of the user_space_program_args structure unsafely, ie. was not using user_memcpy(). * Renamed some local variables in team.c to better fit our style guide (ie. uargs to userArgs). * Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve and report all missing libraries. This fixes bug #1324. * Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now compile with _LOADER_MODE defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
46f4d849 |
|
01-Jun-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Got rid of sLoadingImages. It was always empty. * The previous symbol resolution code was incorrect. It would search all loaded images in the order they had been loaded. Thus an add-on would possibly see a symbol of an earlier loaded add-on. Now we search recursively starting with the respective root image (executable or add-on). * Added BeOS style symbol resolution and made it the default. A symbol undefined in an image is only searched in its direct dependencies. Fixes bug #889 (BeOS apps crashing under Haiku when opening a file panel). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21290 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0c0fea5d |
|
01-Jun-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
elf.c -> elf.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21283 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ebdc1d480e809b6ab0b1ad58822a21395706be25 |
|
11-Apr-2015 |
Michael Lotz <mmlr@mlotz.ch> |
runtime_loader: Add imageName and exactMatch to symbol lookup. Extend the get_nearest_symbol_at_address() private runtime_loader export to include imageName and exactMatch arguments. The imageName holds the SONAME of the image, if available, so cannot neccessarily be extracted from the image path. Whether or not there was an exact match, i.e. the symbol with its size contains the address, is now returned in exactMatch.
|
#
44c0c4d3d0d68c3c3db23858b1089d3cf51bdf16 |
|
03-May-2014 |
Pawel Dziepak <pdziepak@quarnos.org> |
runtime_loader: add support for ELF based TLS This patch introduces support of ELF based TLS handling with lazy allocation and initalization of TLS block for each DSO and thread. The implementation generally follows the official ABI except that generation counter in dtv is in fact a pointer to Generation object that contains both generation counter and size of the dtv. That simplified the implementation a bit, but could be changed later. The ABI requirements regariding in memory position of TLS block is not honoured what results in static TLS model being unsupported. However, that should not be a problem as long as "executables" in Haiku are in fact shared objects and optimizations which require specific TLS block in memory layout are not possible anyway.
|
#
8d23c440f7b0433f0daccf7e4018f99b8d3c3459 |
|
26-Nov-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
runtime loader: Add support for $ORIGIN in rpath Like in Linux it resolves to the directory of the shared object whose needed library is to be loaded.
|
#
ded25be1979db83060a21d11762502c178c77af9 |
|
03-Oct-2013 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
runtime loader: 64-bit ktrace output fixes
|
#
9f3bd49737df7fedbf89ed90570ac1a965814c2b |
|
15-Apr-2013 |
Pawel Dziepak <pdziepak@quarnos.org> |
runtime_loader: explicitly randomize rld_heap and _rld_debug_ positions
|
#
e3ac2588e64059e0c140504e9acc8e73b3c36fdc |
|
25-Jul-2012 |
Alex Smith <alex@alex-smith.me.uk> |
Changed runtime_loader to use elf_* typedefs over Elf32_*. This means that it will be using ELF64 types on x86_64 rather than ELF32. The next step for supporting x86_64 is to implement relocations.
|
#
43e7b1c2b0e1c657aa4904a55fe942704f6e4b6b |
|
31-Mar-2012 |
Hamish Morrison <hamish@lavabit.com> |
Fix dladdr behaviour * If dladdr can't find an exact match, it returns the nearest symbol less than the given address. * If no suitable symbol can be found, but the address is within a loaded library, dladdr returns the library name and base address. Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>
|
#
b6455c080b61ccff5a6c3fc6d35761ed040b6fb9 |
|
07-Aug-2011 |
Axel Dörfler <axeld@pinc-software.de> |
* Implemented dladdr() in the runtime loader. This is like a gazillion times faster than before. * This also solves a TODO in dladdr(), although I did not use get_library_symbol() as I didn't quite see how that could fit as the comment suggested; there is now a new function get_symbol_at_address() for this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42598 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
25dc253d6ab28ce204fa4de2d3e7a27d167fc817 |
|
22-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Merged weak-symbols branch. * Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp * Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
aa3507feea36bec853b8c25a8cff6970754abedd |
|
04-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
terminate_program(): Call the termination function of all images, not only of the program image and its transitive dependencies. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39306 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
d64f6189c009fe90c83d113ef2870c48d13193e9 |
|
04-Nov-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
unload_library(): Added comment about the exit hook handling. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39299 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f71274580bc2625bf438140839fe38193ece28e6 |
|
15-Apr-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Private libroot locking primitives: - Reimplemented mutex to use the _kern_mutex*() syscalls. - The initializer functions cannot fail anymore -- changed their return type to void. - Changed the initializer function semantics to not copy the name by default anymore (as in the kernel). Also added *_etc() versions of them that take an additional flags. - Added static initializer macros. - Made the mutex (and thus recursive_lock) lock functions non-interruptable. - Got rid of the "lazy" version. They are no longer needed, since the initialization of the standard types can be done statically and cannot fail. * Adjusted libroot, runtime loader, and other code using the private libroot locking primitives to the new semantics. * pthreads mutexes and condition variables: - Reimplemented using the _kern_mutex*() syscalls. - Consistently use POSIX error codes. - Fixed some not quite POSIX compliant behavior. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36323 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4f339c2ce12dbe31b829d843b3c2c5fd95a4b17b |
|
19-Mar-2010 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
preload_image(): Removed erroneous rld_unlock() in error case. Fixes #5599. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35919 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
765a039de238142dbcff94f34a277a5f25268d56 |
|
27-Dec-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Pre-load shared objects as libraries, so their symbols will be used automatically and a pre-loaded library will not be loaded again, when it's also a dependency. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34786 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f2bb2575e6aec54c1302c398bf47baebe0e042df |
|
29-Nov-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Use the shared recursive lock implementation instead of the home-grown stuff. The shared implementation is benaphore style, saving unnecessary syscalls. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34338 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
c533f813a2c1392f51f8a0f803ab41775817d530 |
|
27-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Normalized the FATAL messages. The image path is always printed, now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30878 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
94830eb226ce51bd1fd0143bad2538f788883e85 |
|
20-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Moved most code of the heavy elf.cpp into several smaller source files. * Some style cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30808 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
003ebb0e834b8bc6dd69524cc5ffd4860b0466c4 |
|
19-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Also define the build system variables TARGET_STATIC_{LIBSTDC++,LIBSUPC++}. * runtime loader: - Fixed gcc 4 warnings. - Enabled -Werror. - Renamed all remaining *.c source files to *.cpp. - Implemented GNU style ELF symbol versioning support. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30806 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
f91194e546eb645646932f2688feda5669a0ba2e |
|
13-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Removed the gcc_version from the runtime loader's image_t. Instead we always determine (or guess) Haiku version and ABI and use those for compatibility decisions. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30747 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
593ee7bbc334e3ca6ecf6553543ad8037bd7b58a |
|
12-May-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Extended image_info by fields for the Haiku version and ABI. The runtime loader and the kernel read those values from the shared object (if available). In the runtime loader this should eventually replace the gcc version guessing method currently used (at least for shared objects built for Haiku). The optional packages need to be rebuilt first, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30729 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2ecebae14f37692582dc3250004e91ba11485315 |
|
09-Apr-2009 |
David McPaul <dlmcpaul@gmail.com> |
ignore Stack type in elf loader git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30099 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
a2dad9e1a98d23e6d4157292bc25e060558177ee |
|
21-Mar-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
get_library_symbol(): Simplified the RTLD_NEXT case. The caller is not bound to search for a function with the same name as the calling function, so we really don't need to find the calling function; the calling image suffices. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29645 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e94d1badf539e0e265f2ca42865a11ee1c8535f3 |
|
14-Mar-2009 |
Michael Lotz <mmlr@mlotz.ch> |
Add the name of the missing symbol to the error message that is sent via port. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29515 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
80ece78534b0739f931cbdcd7b702fcda79175f6 |
|
28-Feb-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added private get_image_symbol_etc() that can recursively search for a symbol (similar to how dlsym() works). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29356 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
47bc66631194a81a111b321583aef292260cb416 |
|
01-Feb-2009 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The assumption that the program image is not used for relocation of dlopen()ed objects was incorrect. This should fix problems with ports of software with a plugin/add-on interface. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29112 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
df30098d91d97b0b05f75fcc0d7e505abbc8ad2b |
|
09-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
unload_library() invoked from dlclose() might not have deleted images correctly and it returned an error on success. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28578 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0c85bd054ef8be7dc8e9e67f58dc2b6ee289075a |
|
08-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Reworked undefined symbol resolution in the runtime loader. Got rid of the per-root-image breadth-first sorted image array. Instead we have a per-image hook function to resolve the symbols. The default function uses the sLoadedImages list directly, which is breadth-first sorted anyway. There's also a BeOS function for old-style symbol resolution and one for add-ons, which lacks a proper implementation yet (just uses old-style ATM). * Made the dl*() functions POSIX compliant: - dlopen() does no longer use load_add_on(), but loads the object as a library. It also properly supports a NULL name, now -- the previous "_APP_" work-around did only work, if this soname was set on the program (unlikely for programs using this API). - Implemented RTLD_{GLOBAL,LOCAL}. - dlsym() looks up symbols properly now, i.e. not just in the given image, but breadth-first for an actual image or in load order for the global scope. It also supports the not-quite POSIX RTLD_DEFAULT and RTLD_NEXT extensions. Our RTLD_NEXT finds more symbols than in Linux (also in later dlopen()ed libraries), but that should be fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28568 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
10b4b5d1755c3d2b4d405321c8c30bc609dd635d |
|
03-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added an "add-on" interface for the runtime loader. Pre-loaded images can export a structure containing callback hooks invoked by the runtime loader when certain image events occur (image loaded, relocated, initialized, etc.). * Also added a mechanism to patch image symbols. For an image callback functions can be installed that patch symbols exported or imported by the image. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28475 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ca618b22593646856638068715e62e674db2ff4b |
|
01-Nov-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed the way symbols are resolved. For each root image (program, add-on) we create a breadth-first sorted image list and use that to search for symbols. * Added support for preloading libraries. The environment variable LD_PRELOAD can contain a whitespace-separated list of shared objects that will be loaded before the program. This allows to replace symbols without changing the executable or libraries. * Resolved TODO in load_program() regarding the order of remapping the images and initializing the dependencies (problem fixed in r28453). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28455 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
02e577f99a33f6425c661aaae56f56ae5f3f6479 |
|
22-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
When going to load a library also check whether the last path component matches the program's image name. This is a special case for add-ons that link against the application, with the application not having a soname set. The concerned Pe add-ons (HeaderHeader and others) work now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28294 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
b2568a30b160106d0256e6b109f51b532365fa7c |
|
20-Oct-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Patch by romain: Fixed FD leak after opening an image that has already been loaded. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28246 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
85f9771aeccc52a87904e322c7bb450d15da61d6 |
|
11-Oct-2008 |
François Revol <revol@free.fr> |
Avoid crashing if gccPlatform is NULL, thanks Axel! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27968 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2716cfd3d79e5e71870527afc66de278430cc8d9 |
|
10-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Threw away the broken stat() vs. _stat() mechanism to allow for more fields in struct stat. * Instead, I followed Marcus' great idea and added a compatibility check in the runtime loader: now, R5 binaries (also shared libraries) are detected, and they get special versions for stat(), fstat(), and lstat() that return the smaller stat struct. * However, I've disabled (in src/system/libroot/posix/sys/stat.c) using the larger stat field for now, as this breaks some of our optional packages. So until we rebuild them all, this shouldn't be enabled. * This should now also be used for BeOS compatibility in libnetwork.so. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27961 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0555803a4154edad44e4924a317f87c6ea675d71 |
|
06-Oct-2008 |
Axel Dörfler <axeld@pinc-software.de> |
Applied patch by Romain, thanks!: * get_nth_symbol() did not correctly iterate over the symbol hash, causing it to return the same symbols more than once, and omit others. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27896 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
e73923b0c22f0d4246ed916849cbfc12eb413788 |
|
18-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Renamed static recursive lock variables to match our coding style guidelines. * Renamed runtime loader semphore to something clearer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27623 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
9a6072a35ff6121fd299b340105f76ba33206586 |
|
18-Sep-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* Resolved TODO added by Ingo: the runtime loader now lazily updates its image IDs when needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27611 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
cbc456de3b6e980ffc0a01b0fb75afd09a1ab4db |
|
17-Sep-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added TODO regarding updating the image ID's after fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27604 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
320bd2bd5a41bb91c8533a4405c6736bae37b9df |
|
18-Aug-2008 |
Axel Dörfler <axeld@pinc-software.de> |
* More specific error message when relocating fails. * Whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27031 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2a33a944e5b29a2b839ab8655e2d45986be62396 |
|
03-Jun-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Don't spam to the standard output when not finding a symbol. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25784 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
61b37794a4fa1d5766fc704db52b82e628e0149a |
|
17-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added explicit support for loading executables compiled with the respectively other gcc version on a Haiku compiled with gcc 2 or gcc 4. The libraries for such an executable are first searched in "gcc4" respectively "gcc2" subdirectories of the standard search path directories. If not found there, we try again with the standard paths. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25532 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6b202f4e3da73d4c131355fcd82b792d153f84f6 |
|
13-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Introduced new header directory headers/private/system which is supposed to contain headers shared by kernel and userland (mainly libroot). * Moved quite a few private kernel headers to the new location. Split several kernel headers into a shared part and one that is still kernel private. Adjusted all affected Jamfiles and source in the standard x86 build accordingly. The build for other architectures and for test code may be broken. * Quite a bit of userland code still includes private kernel headers. Mostly those are <util/*> headers. The ones that aren't strictly kernel-only should be moved to some other place (maybe headers/private/shared/util). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5d0638bf88bfee783b1b81788cd3cecf77086e29 |
|
10-May-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Changed FATAL macro to always dprintf() the error. Additionally it still prints to stdout, but only until the program and its dependencies are loaded. Failed attempts to load add-ons and the like doesn't pollute stdout anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25437 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6bf15ffcdcfc62c39948e0e9449064e65b7f13bd |
|
27-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Changed macros that enable tracing for individual components from defined/undefined to numeric values (0 for undefined). This allows for trace levels. * Set SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT default to 1, since this is what one usually wants. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25213 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3cf7ecd1e49db0ad531a6d81ad1945c4a6235010 |
|
13-Apr-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Added <sys/mman.h> header. It declares only mmap() and munmap() yet and defines the macros needed by them. * Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the path to an FD parameter. Changed vm_map_file() accordingly and adjusted the kernel ELF loader and the runtime loader. * Added syscall _kern_unmap_memory(). * Added bool unmapAddressRange parameter to vm_create_anonymous_area() and map_backing_store(). If true and the address specification is B_EXACT_ADDRESS, all areas in the specified address range will be deleted (unless an area is covered only partially). * Introduced B_SHARED_AREA flag, which is set on areas that have been created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When fork()ing those areas won't be copied CoW, but rather be cloned. This is needed for mmap() MAP_SHARED. * {vm,_user}_map_file() also accept an FD argument < 0, in which case an anonymous area is created. * Implemented mmap() and munmap(). Currently there's the restriction that we can't partially unmap areas. Otherwise the functions should be rather compliant. We also support the non-POSIX extension MAP_ANONYMOUS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
071f9c3aa2c2215feaa56a8ff59557dd00b27f37 |
|
27-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Build configurations shouldn't be done in svn controlled files, so I finally created a solution to avoid that: Header files that contain configuration settings (and nothing else) go to build/config_headers. To change settings, create a directory build/user_config_headers (which is ignored by svn), copy the respective header there and modify it at your leisure. Currently only tracing_config.h has been moved to the new location, but more files will follow eventually. It is also recommended to move optional macro definitions in Jamfile (as for BFS) to a config header instead; the build system will then automatically rebuild on changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24611 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
92af28df98183cf8031df6513ed015615be0c489 |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Turned the note into a TODO, adding a thought how to implement it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24546 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5fd6637b4d3f8e4e47227db92daa5dc39226aa12 |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Decide whether to use BeOS style symbol resolution at run time depending on the gcc version of the executable. * Adjusted non-BeOS-style symbol resolution so that add-ons and dynamically loaded libraries find symbols in the executable. This change re-enables support for undefined symbols. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24537 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
349828096893d2f5333698e4099b5ad76e2ef4a6 |
|
23-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
The runtime loader now reads a part of the .comment section of each shared object to find out the GCC version it has been compiled with. This is not an exact science, since we've got the version string for every single object file that has been linked in, but my heuristic seems to be good enough. Having the gcc version at hand will allow for two features: Enabling work-arounds for old executables (like the type info problem in BeOS apps), and automatically selecting the right set of libraries in a mixed gcc 2/gcc 4 environment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24534 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
dd76bc97f57ed9545b5fa042e2d193a94e9944fb |
|
19-Mar-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Fixed NULL related warnings. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24484 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
12a5e9a4a272ed7be3e7acd74d3817367efefee4 |
|
17-Feb-2008 |
Axel Dörfler <axeld@pinc-software.de> |
bonefish+axeld: The runtime loader did not correctly resolve %A correctly with the actual normalized program path. IOW it would not work correctly with symlinks to applications that had their own lib directory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23986 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
6918dbf421520a3442a95995ccfb1393b027f506 |
|
07-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Normalize the given image path in load_container(). Just constructing some absolute path was not enough to always recognize a library as already loaded. This fixes problems with Perl where loading an add-on would cause another instance of libperl.so to be loaded, which would lead to crashes due to uninitialized static vars in the new instance. Perl builds now and the tests run, but quite a few do fail. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23930 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
7486b72dd1ef270f3f16dff4d19064c2d6efb51f |
|
07-Feb-2008 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Added some kernel tracing to the runtime loader. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23921 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
3be509a228306fda552ecb7db83217a2f8a2c295 |
|
13-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
Fix the static cleanup mechanism introduced to the runtime_loader/libroot: * Fixed wrong start and size used in the runtime_loader * Fixed off by one error in the matching loop of the cleanup hook * Make sure we successfully acquire the locking sem of the exit stack git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23493 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
8c2a9d743392241b067a471f7835a625b6a57dba |
|
12-Jan-2008 |
Michael Lotz <mmlr@mlotz.ch> |
bonefish+mmlr: As (our) gcc unfortunately uses atexit() to clean up lazily initialized static variables inside functions we have to ensure that we do the right thing with unloadable shared objects. In case a shared object was unloaded that installed an atexit() hook the application would crash on exit. We now implement a callback into libroot that is used to call all the atexit() hooks of a component that is to be unloaded. Most prominently this fixes the media_server crash at shutdown. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23486 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
2760c4cd733828c6febde911ddfe321cd363601c |
|
02-Oct-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* load_program() (and probably others) could call delete_image() with a NULL pointer - which it now handles gracefully. * This also fixes starting the runtime loader directly: it no longer crashes but will just return an error. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22409 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5aa7b7b6da5fd541baf13a1555c0aa9a6580babf |
|
27-Sep-2007 |
Marcus Overhagen <marcusoverhagen@gmail.com> |
Fix broken build and the compiler warning "enumeral mismatch in conditional expression". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22332 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1873b4b37e5dbe9d90e3e186a5c39e51c3a80d99 |
|
10-Aug-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
Give the runtime loader a chance to reinit its semaphore after fork(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21886 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4bef3723a183cc1989f8d90308e427243e309d02 |
|
29-Jul-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* Followed Ingo's suggestion and send the message manually in the runtime loader; therefore, we could remove the ugly defines from KMessage again, and compile it with KMESSAGE_CONTAINER_ONLY. * Added KMessage::SetDeliveryInfo() to be able to send messages with a correct header. * Fixed a bug in KMessage::SendTo() that would not send the senderTeam when passing a negative value for the parameter, but override it when passing in a valid value. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21740 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
74c0424a43b550536d4b55b8fc13631ca4edfcb0 |
|
26-Jul-2007 |
Axel Dörfler <axeld@pinc-software.de> |
* Added a mechanism to retrieve a BMessage with eventual error descriptions for _kern_load_image(). * Added KMessage to the runtime_loader (a bit hacky, though) - it will use it to deliver the above mentioned functionality. * load_dependencies() did return the wrong status code in case a library was missing; now it returns B_MISSING_LIBRARY. * load_dependencies() will now try to load all dependencies when a report message is requested; therefore, all missing libraries are listed. * Renamed uspace_program_args to user_space_program_args. * The kernel filled in various members of the user_space_program_args structure unsafely, ie. was not using user_memcpy(). * Renamed some local variables in team.c to better fit our style guide (ie. uargs to userArgs). * Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve and report all missing libraries. This fixes bug #1324. * Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now compile with _LOADER_MODE defined. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21715 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
46f4d84912d7d74adbd5894e588f5e8efe026393 |
|
01-Jun-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
* Got rid of sLoadingImages. It was always empty. * The previous symbol resolution code was incorrect. It would search all loaded images in the order they had been loaded. Thus an add-on would possibly see a symbol of an earlier loaded add-on. Now we search recursively starting with the respective root image (executable or add-on). * Added BeOS style symbol resolution and made it the default. A symbol undefined in an image is only searched in its direct dependencies. Fixes bug #889 (BeOS apps crashing under Haiku when opening a file panel). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21290 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
0c0fea5de2f680068bfd2c1d69e09d0c096582e4 |
|
01-Jun-2007 |
Ingo Weinhold <ingo_weinhold@gmx.de> |
elf.c -> elf.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21283 a95241bf-73f2-0310-859d-f6bbb57e9c96
|