From 3ac213101204750950a129e1a245c4730525287f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 20:25:29 -0500 Subject: ldso: fix fdpic builds Commit 33cb7f0b4 tried to add a small optimization for skipping unnecessary .dynamic adjustments, but did so by referencing an opaque type. While this works for non-fdpic targets (since the type can be cast to an integer), it falls apart for fdpic targets where the type is actually a structure. Since FDPIC can't support this optimization without walking a series of linked structures, just skip it. Signed-off-by: Mike Frysinger --- ldso/include/dl-elf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ldso/include') diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index cbb2100b1..5aec64f0d 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -162,8 +162,13 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info if (dynamic_info[tag]) \ dynamic_info[tag] = (unsigned long) DL_RELOC_ADDR(load_off, dynamic_info[tag]); \ } while (0) - /* Don't adjust .dynamic unnecessarily. */ - if (load_off != 0) { + /* Don't adjust .dynamic unnecessarily. For FDPIC targets, + we'd have to walk all the loadsegs to find out if it was + actually unnecessary, so skip this optimization. */ +#ifndef __FDPIC__ + if (load_off != 0) +#endif + { ADJUST_DYN_INFO(DT_HASH, load_off); ADJUST_DYN_INFO(DT_PLTGOT, load_off); ADJUST_DYN_INFO(DT_STRTAB, load_off); -- cgit v1.2.3 From 95adc01517efce365da4e40e0d2a081ec4497928 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Wed, 23 Feb 2011 12:56:43 +0100 Subject: Add support for DSBT ELF to ld.so This adds support for DSBT ELF to ld.so. This uses loadmaps like FD-PIC. Some code is added in ld.so to initialize the DSBT tables, and there's also a new target macro FINISH_BOOTSTRAP_RELOC. Signed-off-by: Mark Salter Signed-off-by: Aurelien Jacquiot Signed-off-by: Bernd Schmidt --- ldso/include/dl-defs.h | 2 +- ldso/include/dl-elf.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'ldso/include') diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 2d6303cfe..be0a81da3 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -212,7 +212,7 @@ typedef struct { _dl_find_hash for this reloc TYPE. TPNT is the module in which the matching SYM was found. */ #ifndef DL_FIND_HASH_VALUE -# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr)) +# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) #endif /* Unmap all previously-mapped segments accumulated in LOADADDR. diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 5aec64f0d..7fbb373b4 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -165,7 +165,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info /* Don't adjust .dynamic unnecessarily. For FDPIC targets, we'd have to walk all the loadsegs to find out if it was actually unnecessary, so skip this optimization. */ -#ifndef __FDPIC__ +#if !defined __FDPIC__ && !defined __DSBT__ if (load_off != 0) #endif { @@ -179,6 +179,15 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); #endif } +#ifdef __DSBT__ + /* Get the mapped address of the DSBT base. */ + ADJUST_DYN_INFO(DT_DSBT_BASE_IDX, load_off); + + /* Initialize loadmap dsbt info. */ + load_off.map->dsbt_table = dynamic_info[DT_DSBT_BASE_IDX]; + load_off.map->dsbt_size = dynamic_info[DT_DSBT_SIZE_IDX]; + load_off.map->dsbt_index = dynamic_info[DT_DSBT_INDEX_IDX]; +#endif #undef ADJUST_DYN_INFO return rtld_flags; } -- cgit v1.2.3 From 1dd9275091d6cbb14d6b149770fc90cef53577cf Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:32:30 +0100 Subject: remove trailing ';' from _syscallX() Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ldso/include') diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 982bc9bf6..da3ac7f6f 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -95,7 +95,7 @@ static __always_inline _syscall0(gid_t, _dl_getegid) # define __NR_getpid __NR_getxpid #endif #define __NR__dl_getpid __NR_getpid -static __always_inline _syscall0(gid_t, _dl_getpid); +static __always_inline _syscall0(gid_t, _dl_getpid) #define __NR__dl_readlink __NR_readlink static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, -- cgit v1.2.3