Commit graph

2134 commits

Author SHA1 Message Date
David 'Digit' Turner
63f99f4a4e linker: simplify code for dynamic and ARM exidx sections.
This moves the code that determines where the .dynamic and .ARM.exidx
sections are to a single place in soinfo_link_image().

Change-Id: I98adcb440577bed86442349f03f3c629c945efec
2012-06-26 10:39:55 +02:00
David 'Digit' Turner
8941cfa17a Merge "linker: rename load_offset to load_bias." 2012-06-26 01:34:41 -07:00
David 'Digit' Turner
ff9ff758ad Merge "linker: avoid mapping the whole library before load." 2012-06-26 01:34:31 -07:00
David 'Digit' Turner
48d6c8ed23 Merge "linker: Add PAGE_START/OFFSET/END convenience macros" 2012-06-26 01:34:18 -07:00
David 'Digit' Turner
c6025b6047 Merge "linker: New sources to manage the ELF program header table." 2012-06-26 01:34:07 -07:00
Elliott Hughes
0ff08d22f0 am 5af97ca8: am c7bab8cb: Merge "Enable sqrtf() x86 assembly code"
* commit '5af97ca8514d9fb4175bff3a79abf26889b94530':
  Enable sqrtf() x86 assembly code
2012-06-25 14:09:42 -07:00
Elliott Hughes
5af97ca851 am c7bab8cb: Merge "Enable sqrtf() x86 assembly code"
* commit 'c7bab8cb8483e7869eabdbd4add7c9e5beeecc80':
  Enable sqrtf() x86 assembly code
2012-06-25 14:06:06 -07:00
Elliott Hughes
c7bab8cb84 Merge "Enable sqrtf() x86 assembly code" 2012-06-25 10:46:41 -07:00
David 'Digit' Turner
bea23e59f7 linker: rename load_offset to load_bias.
This patch changes the definition of the 'load_offset' field
in struct soinfo. The field is renamed because it is not the
basic load bias to add to every p_vaddr value read from the ELF
file to get the corresponding memory address.

This also slightly simplifies the relocation code.

+ Fix for proper load_bias computation for relocatable executables.

Change-Id: I72502c75a70751cba324deee7d313ae61f96609e
2012-06-25 11:52:40 +02:00
David 'Digit' Turner
23363ed750 linker: avoid mapping the whole library before load.
This patch changes the load_library() function in the
dynamic linker to avoid reserving a huge read-only
address-space range just to read the ELF header and
program header (which are typically very small and easily
fit in the first page).

Instead, we use the functions in linker_phdr.c to only
load the data that we need in a temporary mmap-allocated
page of memory, which we release when the function exits.

This avoids issues when loading very large libraries, or
simply debug versions that only need to load a tiny percentage
of their overall file content in RAM.

Change-Id: Id3a189fad2119a870a1b3d43dd81380c54ea6044
2012-06-25 11:52:40 +02:00
David 'Digit' Turner
a6545f4678 linker: Add PAGE_START/OFFSET/END convenience macros
This patch adds a few macros related to memory pages to help
clarify some of the code in linker.c

Change-Id: I36c727132d257b1497398dd0a9e8a5a4505467ca
2012-06-25 11:52:40 +02:00
David 'Digit' Turner
c1bd559d5b linker: New sources to manage the ELF program header table.
This patch introduces two new source files containing a set of functions
to manage the program header table in an ELF binary, including the ability
to load PT_LOAD segments, and apply PT_GNU_RELRO protection.

Note: the files are not used currently, this will appear in a series
      of future patches that will gradually modify linker.c to use
      the phdr_table_xxx functions properly.

Change-Id: Ia3d4c1ff5fc3e265d8258b64b492f4e643f51bdc
2012-06-25 11:52:40 +02:00
xqian6
29aa009924 Enable sqrtf() x86 assembly code
This patch can improve the sqrtf() performance.

Change-Id: Ic9d11d6a9ecd9b263f54d4878e13595e136b95ce
2012-06-25 16:20:09 +08:00
Evgeniy Stepanov
20bc061dc7 Add module base to main executable's ARM_exidx.
BUG:6697872

Change-Id: I448f4b86397307086231776da38a7af334a75fe5
2012-06-22 14:56:01 +04:00
Andrew Hsieh
63d0ceec75 am fa136e8c: am a5948157: Merge "Define __stack_chk_fail_local.S"
* commit 'fa136e8ca71cb20956cd1792251869cac8bed257':
  Define __stack_chk_fail_local.S
2012-06-20 19:00:55 -07:00
Andrew Hsieh
fa136e8ca7 am a5948157: Merge "Define __stack_chk_fail_local.S"
* commit 'a5948157fd34acb2b1d1bfaf129901af865ab5fc':
  Define __stack_chk_fail_local.S
2012-06-20 18:58:18 -07:00
Andrew Hsieh
a5948157fd Merge "Define __stack_chk_fail_local.S" 2012-06-20 18:37:48 -07:00
Andrew Hsieh
6973e3da87 Define __stack_chk_fail_local.S
With -fstack-protector, x86 -m32 needs __stack_chk_fail_local
defined in crtbegin_*.o.

Include __stack_chk_fail_local.S in begin.S otherwise linker
(which is built w/o crt*) may not link.

Change-Id: Id242fcf3eff157264afe3b04f27288ab7991220a
2012-06-21 09:26:33 +08:00
The Android Open Source Project
214feeba19 am effc607e: Reconcile with jb-release
* commit 'effc607e87add0aec14fefb4ac1c00d36559149a':
2012-06-20 08:28:23 -07:00
The Android Open Source Project
effc607e87 Reconcile with jb-release
Change-Id: Ia5de9692e507a605d3b6937ec65da26169a3ea8e
2012-06-20 08:25:32 -07:00
The Android Automerger
77093f2a8b merge in jb-release history after reset to jb-dev 2012-06-20 06:59:21 -07:00
David 'Digit' Turner
823aeb9294 Merge "linker: reduce size by nearly 20KB" 2012-06-19 14:51:28 -07:00
Andy McFadden
f2ba5c9afa am 63c4179f: am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev
* commit '63c4179f5951edc2d68700fe75659fbd34febe63':
  Minor tweak to get memory around corrupted heap chunks dumped.
2012-06-19 11:33:19 -07:00
Andy McFadden
63c4179f59 am 4d0128f1: Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev
* commit '4d0128f13a3ca9f7a0c81b6e69f7e20d28e9e6e3':
  Minor tweak to get memory around corrupted heap chunks dumped.
2012-06-19 11:31:14 -07:00
Andy McFadden
4d0128f13a Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev 2012-06-19 11:28:15 -07:00
Ben Cheng
ec2ab73b87 Minor tweak to get memory around corrupted heap chunks dumped.
Change-Id: I8f72c5c7e23960b13fc53e2354cd74aca8aac3c0
2012-06-19 07:11:38 -07:00
David 'Digit' Turner
166b7dbd4a linker: reduce size by nearly 20KB
This patch adds a trivial implementation of snprintf() that calls
our internal vsnprintf().

Inspection of the generated machine code showed that the linker
contained a full implementation of stdio's vfprintf. It was pulled
in because the pthread implementation uses snprintf() somewhere.

ProTip: It's possible to see why specific objects files are included
in a final binary by adding the following to your Android.mk, then
looking at the content of /tmp/MAP.TXT:

  LOCAL_LDFLAGS += -Wl,-Map=/tmp/MAP.TXT

Change-Id: I325e71b0cad1d01116a2e00c09e30a80cb716aa3
2012-06-19 10:53:11 +02:00
Arve Hjønnevåg
ece8f502ed Merge "Add watchdog.h" 2012-06-14 16:13:16 -07:00
Nick Kralevich
70f6901c3d libc: make atoi, atol, and atoll pure functions
Change-Id: Ib831c079c865929b6c91d42f35e117f2e974808f
2012-06-14 13:57:43 -07:00
Nick Kralevich
8df49ad246 FORTIFY_SOURCE: add strlcpy / strlcat support
Add strlcpy / strlcat support to FORTIFY_SOURCE. This allows
us to do consistency checks on to ensure we don't overflow buffers
when the compiler is able to tell us the size of the buffer we're
dealing with.

Unlike previous changes, this change DOES NOT use the compiler's
builtin support. Instead, we do everything the compiler would
normally do.

Change-Id: I47c099a911382452eafd711f8e9bfe7c2d0a0d22
2012-06-14 12:52:42 -07:00
Arve Hjønnevåg
420f4939b3 Add watchdog.h
Change-Id: Ib12d437151ccfbd634e9f01acd8556c79977ca04
2012-06-13 21:58:08 -07:00
David 'Digit' Turner
4442d512c6 Merge "linker: small code-cleanup" 2012-06-13 21:45:52 -07:00
Nick Kralevich
a5eaa02f62 Merge "Don't mark realloc with __attribute__((malloc))" 2012-06-13 16:13:32 -07:00
Nick Kralevich
b27631b9ae Don't mark realloc with __attribute__((malloc))
According to
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

realloc should NOT be marked with __attribute__((malloc)). Quoting:

   realloc-like functions do not have this property as the memory
   pointed to does not have undefined content.

For reference, __mallocfunc is defined in sys/cdefs.h as:

    #define __mallocfunc  __attribute__((malloc))

Change-Id: I56083542ba92e4608dd7c55fb5596a138eb50cc9
2012-06-13 15:43:14 -07:00
David 'Digit' Turner
1608416811 linker: small code-cleanup
This patch adds to make the linker a little bit easier to understand
by making all functions that acts on a sofino object with a soinfo_
prefix.

This is to more easily distinguish functions that operate on global
state, and those that operate on individual libraries.

This should be purely stylistic, i.e. no feature/behaviour change.

Change-Id: Ie510d13d743aa4317644caefa9910b8af7e84f44
2012-06-13 22:47:20 +02:00
Nick Kralevich
8c54c56723 Merge "FORTIFY_SOURCE: add sprintf / vsprintf support" 2012-06-13 11:03:42 -07:00
Nick Kralevich
9b549c39c9 FORTIFY_SOURCE: add sprintf / vsprintf support
sprintf FORTIFY_SOURCE protections are not available
on clang.

Also add various __attribute__s to stdio functions.

Change-Id: I936d1f9e55fe53a68885c4524b7b59e68fed218d
2012-06-13 09:14:30 -07:00
Nick Kralevich
ca622f5748 Merge "update filter.h / prctl.h / seccomp.h" 2012-06-12 16:34:46 -07:00
Robert Greenwalt
8f88aa7d38 am c5cab345: am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit 'c5cab3452d5ced55474e56497594579108670b51':
  Avoid multiple dns lookups for the same query
2012-06-12 15:56:29 -07:00
Robert Greenwalt
c5cab3452d am 028ccf5d: Merge "Avoid multiple dns lookups for the same query"
* commit '028ccf5d40dd9a945ea92aa79822c08c6f6aa1d2':
  Avoid multiple dns lookups for the same query
2012-06-12 15:52:56 -07:00
Nick Kralevich
d1a6918508 update filter.h / prctl.h / seccomp.h
Pull in an updated version of filter.h / prctl.h / seccomp.h
from the linux kernel.  Pulled from upstream kernel at
94fa83c424321189ca24fb6cb4c0d224cdedc72d

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/seccomp.h
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/filter.h
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/prctl.h

Change-Id: I1ca996541d05b0d5927ab828a6ce49c09877ea01
2012-06-12 15:46:31 -07:00
Robert Greenwalt
028ccf5d40 Merge "Avoid multiple dns lookups for the same query" 2012-06-12 15:06:24 -07:00
Nick Kralevich
c2f1d215b1 Merge "FORTIFY_SOURCE: add snprintf, vsnprintf" 2012-06-12 08:50:57 -07:00
Elliott Hughes
f525fb525b am 20afd4e7: am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."
* commit '20afd4e70c2f346d7cd03a7a3049f8de2d176d5c':
  Remove the meaningless on Linux if_dl.h header.
2012-06-11 17:42:44 -07:00
Elliott Hughes
c9142d4d8e am 571da80c: am c75491e2: Merge "Remove an obsolete jamfile."
* commit '571da80c58e13eac4d4fb29d38342879e5dede13':
  Remove an obsolete jamfile.
2012-06-11 17:42:43 -07:00
Elliott Hughes
20afd4e70c am e0961445: Merge "Remove the meaningless on Linux if_dl.h header."
* commit 'e0961445124b5ff39412da32578e14e0d1f6afd6':
  Remove the meaningless on Linux if_dl.h header.
2012-06-11 17:41:10 -07:00
Elliott Hughes
571da80c58 am c75491e2: Merge "Remove an obsolete jamfile."
* commit 'c75491e291586540c213ae088fc75b71fc4d3752':
  Remove an obsolete jamfile.
2012-06-11 17:41:04 -07:00
Elliott Hughes
e096144512 Merge "Remove the meaningless on Linux if_dl.h header." 2012-06-11 16:49:57 -07:00
Nick Kralevich
cffdf6693f FORTIFY_SOURCE: add snprintf, vsnprintf
Add _FORTIFY_SOURCE support for snprintf, vsnprintf

At this time, we opt out of these protections for clang, as clang
does not implement __builtin_va_arg_pack().

http://clang.llvm.org/docs/UsersManual.html#c_unimpl_gcc

Change-Id: I73ebe5ec8dad1dca8898a76d6afb693a25f75375
2012-06-11 16:46:16 -07:00
Elliott Hughes
c75491e291 Merge "Remove an obsolete jamfile." 2012-06-11 16:29:46 -07:00