am 65ba5b62
: am 064f862d
: Merge "Stop defining our own PAGE_SIZE and PAGE_MASK, and test dlclose(3) too."
* commit '65ba5b62c5a59181317b86f772d9ebb756d4741f': Stop defining our own PAGE_SIZE and PAGE_MASK, and test dlclose(3) too.
This commit is contained in:
commit
02c3513e5f
3 changed files with 12 additions and 22 deletions
|
@ -72,8 +72,6 @@
|
|||
* - cleaner error reporting
|
||||
* - after linking, set as much stuff as possible to READONLY
|
||||
* and NOEXEC
|
||||
* - linker hardcodes PAGE_SIZE and PAGE_MASK because the kernel
|
||||
* headers provide versions that are negative...
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -36,25 +36,14 @@
|
|||
|
||||
#include <link.h>
|
||||
|
||||
#undef PAGE_MASK
|
||||
#undef PAGE_SIZE
|
||||
#define PAGE_SIZE 4096
|
||||
#define PAGE_MASK (PAGE_SIZE-1)
|
||||
// Returns the address of the page containing address 'x'.
|
||||
#define PAGE_START(x) ((x) & PAGE_MASK)
|
||||
|
||||
/* Convenience macros to make page address/offset computations more explicit */
|
||||
// Returns the offset of address 'x' in its page.
|
||||
#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
|
||||
|
||||
/* Returns the address of the page starting at address 'x' */
|
||||
#define PAGE_START(x) ((x) & ~PAGE_MASK)
|
||||
|
||||
/* Returns the offset of address 'x' in its memory page, i.e. this is the
|
||||
* same than 'x' - PAGE_START(x) */
|
||||
#define PAGE_OFFSET(x) ((x) & PAGE_MASK)
|
||||
|
||||
/* Returns the address of the next page after address 'x', unless 'x' is
|
||||
* itself at the start of a page. Equivalent to:
|
||||
*
|
||||
* (x == PAGE_START(x)) ? x : PAGE_START(x)+PAGE_SIZE
|
||||
*/
|
||||
// Returns the address of the next page after address 'x', unless 'x' is
|
||||
// itself at the start of a page.
|
||||
#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
|
||||
|
||||
void debugger_init();
|
||||
|
@ -167,9 +156,6 @@ struct soinfo {
|
|||
|
||||
extern soinfo libdl_info;
|
||||
|
||||
|
||||
#include <asm/elf.h>
|
||||
|
||||
#if defined(ANDROID_ARM_LINKER)
|
||||
|
||||
// These aren't defined in <arch-arm/asm/elf.h>.
|
||||
|
|
|
@ -46,6 +46,8 @@ TEST(dlopen, dlsym_in_self) {
|
|||
gCalled = false;
|
||||
function();
|
||||
ASSERT_TRUE(gCalled);
|
||||
|
||||
ASSERT_EQ(0, dlclose(self));
|
||||
}
|
||||
|
||||
TEST(dlopen, dlopen_failure) {
|
||||
|
@ -108,6 +110,8 @@ TEST(dlopen, dlsym_failures) {
|
|||
sym = dlsym(self, "ThisSymbolDoesNotExist");
|
||||
ASSERT_TRUE(sym == NULL);
|
||||
ASSERT_SUBSTR("undefined symbol: ThisSymbolDoesNotExist", dlerror());
|
||||
|
||||
ASSERT_EQ(0, dlclose(self));
|
||||
}
|
||||
|
||||
TEST(dlopen, dladdr) {
|
||||
|
@ -166,6 +170,8 @@ TEST(dlopen, dladdr) {
|
|||
|
||||
// The base address should be the address we were loaded at.
|
||||
ASSERT_EQ(info.dli_fbase, base_address);
|
||||
|
||||
ASSERT_EQ(0, dlclose(self));
|
||||
}
|
||||
|
||||
TEST(dlopen, dladdr_invalid) {
|
||||
|
|
Loading…
Reference in a new issue