Commit graph

1543 commits

Author SHA1 Message Date
Jean-Baptiste Queru
10be95cffc merge from open-source master 2009-11-08 16:09:17 -08:00
Shin-ichiro KAWASAKI
ad13c57298 added and modified linker to support SuperH architecture 2009-11-06 10:36:37 +09:00
Doug Kwan
e823807dc2 Add weak symbol support. Also fix a bug caused by a typo. 2009-10-26 12:05:23 -07:00
Iliyan Malchev
f1729553e3 am 9e78de3e: am 70bba516: am 763ac283: Merge changes Ibcba4b4f,I9af341e1 into eclair
Merge commit '9e78de3e3c90ec3c2970431d8eae7378fdc0dac6'

* commit '9e78de3e3c90ec3c2970431d8eae7378fdc0dac6':
  bionic/linker: make the buddy allocator compute max_order on its own
  bionic/linker: change the buddy allocator to take a handle to the managed area
2009-10-23 18:58:19 -07:00
Iliyan Malchev
9e78de3e3c am 70bba516: am 763ac283: Merge changes Ibcba4b4f,I9af341e1 into eclair
Merge commit '70bba5160f83ecd6251c4539f747ae39e9ed469c' into eclair-mr2-plus-aosp

* commit '70bba5160f83ecd6251c4539f747ae39e9ed469c':
  bionic/linker: make the buddy allocator compute max_order on its own
  bionic/linker: change the buddy allocator to take a handle to the managed area
2009-10-23 18:49:14 -07:00
Iliyan Malchev
53b32f8b7e am 763ac283: Merge changes Ibcba4b4f,I9af341e1 into eclair
Merge commit '763ac28357f604e0e4196e0a7ad5b0f5cdcf274a' into eclair-plus-aosp

* commit '763ac28357f604e0e4196e0a7ad5b0f5cdcf274a':
  bionic/linker: make the buddy allocator compute max_order on its own
  bionic/linker: change the buddy allocator to take a handle to the managed area
2009-10-23 18:39:30 -07:00
Iliyan Malchev
70bba5160f am 763ac283: Merge changes Ibcba4b4f,I9af341e1 into eclair
Merge commit '763ac28357f604e0e4196e0a7ad5b0f5cdcf274a' into eclair-mr2

* commit '763ac28357f604e0e4196e0a7ad5b0f5cdcf274a':
  bionic/linker: make the buddy allocator compute max_order on its own
  bionic/linker: change the buddy allocator to take a handle to the managed area
2009-10-23 18:38:35 -07:00
Doug Kwan
943043583a Clean up some linker code. 2009-10-23 18:11:40 -07:00
Iliyan Malchev
bb9eedeff4 bionic/linker: make the buddy allocator compute max_order on its own
Signed-off-by: Iliyan Malchev <malchev@google.com>
2009-10-19 18:10:35 -07:00
Iliyan Malchev
af7315acf6 bionic/linker: change the buddy allocator to take a handle to the managed area
-- rename struct ba_info to struct ba
-- move the static ba descriptor from ba.c to linker.c and rename it ba_prelink
-- ba_init, ba_allocate, ba_free, ba_start_addr, and ba_len all take a pointer
   to struct ba

Signed-off-by: Iliyan Malchev <malchev@google.com>
2009-10-19 18:10:35 -07:00
David 'Digit' Turner
b3cfdb6220 am eeaf6544: Merge change I7934a799 into eclair-mr2
Merge commit 'eeaf6544b676f68ccdd70a3fa78f44789a1bf69c' into eclair-mr2-plus-aosp

* commit 'eeaf6544b676f68ccdd70a3fa78f44789a1bf69c':
  Prevent spurious EINTR to freeze process debugging
2009-10-19 15:03:31 -07:00
Android (Google) Code Review
eeaf6544b6 Merge change I7934a799 into eclair-mr2
* changes:
  Prevent spurious EINTR to freeze process debugging
2009-10-19 17:55:08 -04:00
David 'Digit' Turner
5d436ddcae am 8213d5c3: am ff7b46b8: Merge change I3c998761 into eclair
Merge commit '8213d5c3c072b23f5cc1922d232efe7338091d9b' into eclair-mr2-plus-aosp

* commit '8213d5c3c072b23f5cc1922d232efe7338091d9b':
  Allow the dynamic linker to relocate references to thumb symbols in NDK libraries.
2009-10-16 12:46:51 -07:00
David 'Digit' Turner
cd23098828 am ff7b46b8: Merge change I3c998761 into eclair
Merge commit 'ff7b46b87c4d85881d88c2105a94be6c6accb628' into eclair-plus-aosp

* commit 'ff7b46b87c4d85881d88c2105a94be6c6accb628':
  Allow the dynamic linker to relocate references to thumb symbols in NDK libraries.
2009-10-16 12:36:27 -07:00
David 'Digit' Turner
7934a799e1 Prevent spurious EINTR to freeze process debugging 2009-10-16 12:14:04 -07:00
Jean-Baptiste Queru
73981476a3 merge from open-source master 2009-10-14 08:18:23 -07:00
David 'Digit' Turner
3c99876116 Allow the dynamic linker to relocate references to thumb symbols in NDK libraries.
The lowest bit of the symbol's value should be ignored when looking at UNDEF symbols
for correctness. It is used as an ARM/Thumb flag by the linker.
2009-10-13 16:55:18 -07:00
Iliyan Malchev
4a9afcb101 bionic/linker: allow resolving of symbols from library back to executable
Signed-off-by: Iliyan Malchev <malchev@google.com>
2009-09-29 14:33:46 -07:00
Iliyan Malchev
9ea64da6c5 bionic/linker: change lookup() to return soinfo, not base 2009-09-29 14:33:46 -07:00
Iliyan Malchev
6ed80c8814 Revert "Revert "bionic/linker: fix symbol lookup during relocations""
This reverts commit 33acbf0719.
2009-09-29 14:33:46 -07:00
Mathias Agopian
33acbf0719 Revert "bionic/linker: fix symbol lookup during relocations"
This reverts commit 8d0c0334f1.
2009-09-27 22:04:15 -07:00
Iliyan Malchev
8d0c0334f1 bionic/linker: fix symbol lookup during relocations
When resolving relocations while loading a library, the linker used to find
symbols by looking them up in the list of all linked libraries for the current
process, as opposed to following just the library's DT_NEEDED entries.  This
can cause a problem where the symbol is picked up from the wrong library.

Signed-off-by: Iliyan Malchev <malchev@google.com>
2009-09-27 17:18:06 -07:00
Thinker K.F Li
5cf640c926 Fill l_ld of linkmaps with value from soinfo::dynamic.
GDB will try to read l_ld of linkmaps and compare the value to vma of
.dynamic sections from shared objects.  Since linker does not assign l_ld,
GDB will complain about and re-compute l_addr from l_ld.  And, GDB will get a
wrong value.
2009-09-15 17:05:55 -07:00
Erik Gilling
30eb40241c bionic: linker: add error message if link failed due to previous error
Signed-off-by: Erik Gilling <konkers@android.com>
2009-08-13 16:18:07 -07:00
Erik Gilling
fde8642fc4 bionic/linker: keep track of opened libraries by basename
Prior to this change, the dynamic loader kept track of opened libraries
either by their base name (i.e., libfoo.so instead of /system/lib/libfoo.so)
when the shared library was loaded through the DT_NEEDED tag in an ELF header,
or by whatever name was passed to dlopen(). This created a number of problems,
among which:

1. dlopen("libfoo.so") and dlopen("/path/to/libfoo.so") would open the same
library twice;
2. dlopen("/path/to/libfoo.so") and then dlopen("libbar.so"), where libbar.so
depends on libfoo.so, would open libfoo.so twice.

This patch makes the dynamic loader keep track of each loaded library by
basename, which resolves the above ambiguity. The patch also enforces
library lookup by base name, which means that it will refuse to load another
library that has the same name.

Thanks for the inspiration Iliyan.

Signed-off-by: Erik Gilling <konkers@android.com>
Cc: Iliyan Malchev <malchev@google.com>
2009-07-28 20:36:47 -07:00
Erik Gilling
d00d23a9d4 linker: remove newlines from DL_ERR so that dlerror works correctly
Signed-off-by: Erik Gilling <konkers@android.com>
2009-07-22 17:10:39 -07:00
David 'Digit' Turner
ef0bd18570 Pass the elfdata pointer in a slot of the temporary TLS area.
This is needed to properly initialize the C runtime when libc.so
is loaded by the dynamic linker.

Move the temporary TLS setup before the first system call, just
in case something really horrible happens, we won't crash when
trying to write an error code in 'errno'

Remove the broken TLS_SLOT_THREAD_ID setup. First, this slot
should normally receive the address of a pthread_internal_t,
not a kernel thread identifier. Second, it is never used by
the linker anyway.

Also remove an obsolete comment.
2009-07-17 17:55:01 +02:00
David Bartley
bc3a5c26f1 Add LD_LIBRARY_PATH support to bionic's linker 2009-06-15 21:36:03 -07:00
Dima Zavin
0353195f34 linker: Give more context for failures during library dependency resolution.
Signed-off-by: Dima Zavin <dima@android.com>
2009-06-01 12:55:48 -07:00
Dima Zavin
2e85579c34 linker: Make the errors reported by dlopen/dlsym be more useful.
Changed it so that when the linker generates error messages, they are
scribbled away into a buffer that dlfcn and friends can read from.

Since the error messages are generetad with snprintf, and snprintf
MAY call malloc during some code paths, we now link against a version
of libc that does not contain malloc/free/realloc/calloc. We then define
malloc and friends in the dynamic loader, and make them abort() if they
are ever called.

Signed-off-by: Dima Zavin <dima@android.com>
2009-05-27 20:16:19 -07:00
David 'Digit' Turner
8215679b35 Fix the parsing of the .fini_array in the dynamic linker (it should happen in reverse order).
Also add a small design overview document for the linker. The latter contains details on
how the initialization/finalization is supposed to work.
2009-05-26 11:16:28 +02:00
Dima Zavin
d1b40d8c69 linker: Compute symbol name before lookup so we can also use it for error msg
Signed-off-by: Dima Zavin <dima@android.com>
2009-05-12 10:59:09 -07:00
James Dong
ba52b3092f Increase the limit of loaded shared libraries from 64 to 96 This change is required for OpenCORE 2.0
This is the same as Change 71 in master branch.
2009-04-30 20:37:36 -07:00
Iliyan Malchev
5e12d7ec70 Automated import from //branches/donutburger/...@140950,140950 2009-03-24 19:02:00 -07:00
The Android Open Source Project
1dc9e472e1 auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
The Android Open Source Project
1767f908af auto import from //depot/cupcake/@135843 2009-03-03 18:28:13 -08:00
The Android Open Source Project
a799b53f10 auto import from //depot/cupcake/@132589 2009-03-03 14:03:51 -08:00
The Android Open Source Project
fe5745033a auto import from //depot/cupcake/@137055 2009-03-02 22:54:14 -08:00
The Android Open Source Project
6f04a0f4c7 auto import from //branches/cupcake/...@132276 2009-02-19 10:57:29 -08:00
The Android Open Source Project
9f65adf2ba auto import from //branches/cupcake/...@130745 2009-02-10 15:43:56 -08:00
The Android Open Source Project
e5cc1f386b auto import from //branches/cupcake/...@126645 2009-01-15 16:12:07 -08:00
The Android Open Source Project
4e468ed2eb Code drop from //branches/cupcake/...@124589 2008-12-17 18:03:48 -08:00
The Android Open Source Project
a27d2baa0c Initial Contribution 2008-10-21 07:00:00 -07:00