Commit Graph

14 Commits

Author SHA1 Message Date
Ingo Weinhold b3f709b800 Removed unused elf_version_info::hidden field.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-21 13:11:54 +00:00
Ingo Weinhold 003ebb0e83 * 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
2009-05-20 02:22:36 +00:00
Ingo Weinhold f91194e546 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
2009-05-13 14:44:17 +00:00
Ingo Weinhold 593ee7bbc3 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
2009-05-12 21:08:56 +00:00
Ingo Weinhold 80ece78534 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
2009-02-28 18:50:40 +00:00
Ingo Weinhold 0c85bd054e * 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
2008-11-08 22:40:56 +00:00
Ingo Weinhold 10b4b5d175 * 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
2008-11-03 13:27:14 +00:00
Ingo Weinhold 19d40f9eb7 Moved the rld_export structure from <user_runtime.h> to
<runtime_loader.h>, since it isn't a kernel <-> userland interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28456 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-02 03:43:01 +00:00
Ingo Weinhold ca618b2259 * 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
2008-11-02 03:16:30 +00:00
Axel Dörfler 2716cfd3d7 * 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
2008-10-10 22:13:05 +00:00
Ingo Weinhold 5fd6637b4d * 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
2008-03-23 19:43:41 +00:00
Ingo Weinhold 3498280968 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
2008-03-23 17:01:42 +00:00
Axel Dörfler fe7f3a2f1d Now supports symbolic links correctly, and no longer loads the same shared
library twice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-27 00:07:42 +00:00
Ingo Weinhold 28e0d4cd19 The runtime loader now creates a debug area through which other teams can
access a team's internal loader data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-07-16 21:07:17 +00:00