summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rules.mak4
-rw-r--r--extra/Configs/Config.frv.default5
-rw-r--r--include/elf.h14
-rw-r--r--ldso/include/dl-string.h8
-rw-r--r--ldso/ldso/Makefile8
-rw-r--r--ldso/ldso/frv/dl-inlines.h12
-rw-r--r--ldso/ldso/frv/dl-startup.h4
-rw-r--r--ldso/ldso/frv/dl-sysdep.h26
-rw-r--r--ldso/ldso/frv/elfinterp.c7
-rw-r--r--ldso/libdl/Makefile2
-rw-r--r--libc/sysdeps/linux/frv/Makefile2
11 files changed, 73 insertions, 19 deletions
diff --git a/Rules.mak b/Rules.mak
index 7c55ed6bc..2b804b404 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -191,7 +191,7 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
PICFLAG=-fPIC -DPIC
- PIEFLAG=$(call check_gcc,-fpie,)
+ PIEFLAG=-fpie
# Using -pie causes the program to have an interpreter, which is
# forbidden, so we must make do with -shared. Unfortunately,
# -shared by itself would get us global function descriptors
@@ -251,7 +251,7 @@ endif
# Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include'
#CFLAGS+=-iwithprefix include
-CFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
+CFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
ifneq ($(DOASSERTS),y)
CFLAGS += -DNDEBUG
diff --git a/extra/Configs/Config.frv.default b/extra/Configs/Config.frv.default
index 4e2e1747e..af6f1daed 100644
--- a/extra/Configs/Config.frv.default
+++ b/extra/Configs/Config.frv.default
@@ -50,6 +50,9 @@ BUILD_UCLIBC_LDSO=y
FORCE_SHAREABLE_TEXT_SEGMENTS=y
UCLIBC_PIE_SUPPORT=y
LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+LDSO_PRELOAD_FILE_SUPPORT=y
+LDSO_BASE_FILENAME="ld.so.1"
UCLIBC_CTOR_DTOR=y
# UCLIBC_PROPOLICE is not set
# HAS_NO_THREADS is not set
@@ -80,6 +83,8 @@ UCLIBC_HAS_FULL_RPC=y
#
# String and Stdio Support
#
+UCLIBC_HAS_STRING_GENERIC_OPT=y
+UCLIBC_HAS_STRING_ARCH_OPT=y
UCLIBC_HAS_CTYPE_TABLES=y
UCLIBC_HAS_CTYPE_SIGNED=y
# UCLIBC_HAS_CTYPE_UNSAFE is not set
diff --git a/include/elf.h b/include/elf.h
index ce37414f1..0dcbc8f0f 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1,5 +1,6 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995-1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -1153,6 +1154,17 @@ typedef struct
/* Private function descriptor initialization. */
#define R_FRV_FUNCDESC_VALUE 18
+ /* gpr support */
+#define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */
+#define EF_FRV_GPR_32 0x00000001 /* -mgpr-32 */
+#define EF_FRV_GPR_64 0x00000002 /* -mgpr-64 */
+
+ /* fpr support */
+#define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */
+#define EF_FRV_FPR_32 0x00000004 /* -mfpr-32 */
+#define EF_FRV_FPR_64 0x00000008 /* -mfpr-64 */
+#define EF_FRV_FPR_NONE 0x0000000c /* -msoft-float */
+
#define EF_FRV_PIC 0x00000100
#define EF_FRV_FDPIC 0x00008000
diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
index c428634d2..9426860cc 100644
--- a/ldso/include/dl-string.h
+++ b/ldso/include/dl-string.h
@@ -262,6 +262,14 @@ static inline char *_dl_simple_ltoahex(char * local, unsigned long i)
#define SEND_STDERR(X) _dl_write(2, X, _dl_strlen(X));
#endif
+/* Some targets may have to override this to something that doesn't
+ reference constant strings through the GOT. This macro should be
+ preferred over SEND_STDERR for constant strings before we complete
+ bootstrap. */
+#ifndef SEND_EARLY_STDERR
+# define SEND_EARLY_STDERR(S) SEND_STDERR(S)
+#endif
+
#define SEND_ADDRESS_STDERR(X, add_a_newline) { \
char tmp[22], *tmp1; \
_dl_memset(tmp, 0, sizeof(tmp)); \
diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index f58c3e857..2d2abeeb6 100644
--- a/ldso/ldso/Makefile
+++ b/ldso/ldso/Makefile
@@ -39,7 +39,13 @@ XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFLAG) \
# BEWARE!!! At least mips* will die if -O0 is used!!!
XXFLAGS :=$(XXFLAGS:-O0=-O1)
-XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
+ifeq ($(PIEFLAG),)
+PIEFLAG=-fPIC
+endif
+
+XXFLAGS+=$(PIEFLAG)
+
+XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
LDFLAGS=$(CPU_LDFLAGS-y) -z now -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
-z combreloc --discard-locals --discard-all --no-undefined
diff --git a/ldso/ldso/frv/dl-inlines.h b/ldso/ldso/frv/dl-inlines.h
index f09c8b93a..855362e10 100644
--- a/ldso/ldso/frv/dl-inlines.h
+++ b/ldso/ldso/frv/dl-inlines.h
@@ -414,11 +414,11 @@ _dl_funcdesc_for (void *entry_point, void *got_value)
return _dl_stabilize_funcdesc (*entry);
}
-inline static void *
-_dl_lookup_address (void *address)
+inline static void const *
+_dl_lookup_address (void const *address)
{
struct elf_resolve *rpnt;
- struct funcdesc_value *fd;
+ struct funcdesc_value const *fd;
/* Make sure we don't make assumptions about its alignment. */
asm ("" : "+r" (address));
@@ -427,7 +427,7 @@ _dl_lookup_address (void *address)
/* It's not a function descriptor. */
return address;
- fd = (struct funcdesc_value *)address;
+ fd = (struct funcdesc_value const *)address;
for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next)
{
@@ -439,9 +439,9 @@ _dl_lookup_address (void *address)
address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0);
- if (address && *(struct funcdesc_value **)address == fd)
+ if (address && *(struct funcdesc_value *const*)address == fd)
{
- address = (*(struct funcdesc_value **)address)->entry_point;
+ address = (*(struct funcdesc_value *const*)address)->entry_point;
break;
}
else
diff --git a/ldso/ldso/frv/dl-startup.h b/ldso/ldso/frv/dl-startup.h
index 98c5677f6..46875c95e 100644
--- a/ldso/ldso/frv/dl-startup.h
+++ b/ldso/ldso/frv/dl-startup.h
@@ -145,7 +145,3 @@ struct elf32_fdpic_loadmap;
/* _dl_dprintf(2, "entry point is (%x,%x)\n", dl_main_funcdesc->entry_point, dl_main_funcdesc->got_value); */ \
return; \
} while (0)
-
-
-
-
diff --git a/ldso/ldso/frv/dl-sysdep.h b/ldso/ldso/frv/dl-sysdep.h
index 32d540caf..158f6af04 100644
--- a/ldso/ldso/frv/dl-sysdep.h
+++ b/ldso/ldso/frv/dl-sysdep.h
@@ -129,6 +129,16 @@ struct funcdesc_ht;
#define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \
(! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr))
+/* Make sure we only load libraries that use the same number of
+ general-purpose and floating-point registers the dynamic loader was
+ compiled for. */
+#define DL_CHECK_REG_COUNT(flags) \
+ (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \
+ && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \
+ && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \
+ && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \
+ && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1))
+
/* We only support loading FDPIC independently-relocatable shared
libraries. It probably wouldn't be too hard to support loading
shared libraries that require relocation by the same amount, but we
@@ -149,6 +159,14 @@ do \
_dl_close(infile); \
return NULL; \
} \
+\
+ if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \
+ { \
+ _dl_internal_error_number = LD_ERROR_NOTDYN; \
+ _dl_dprintf(2, "%s: '%s' assumes different register counts" \
+ "\n", (_dl_progname), (libname)); \
+ _dl_close(infile); \
+ } \
} \
while (0)
@@ -172,6 +190,14 @@ while (0)
(TPNT)->loadaddr.got_value) \
: DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr))
+#define DL_GET_READY_TO_RUN_EXTRA_PARMS \
+ , struct elf32_fdpic_loadmap *dl_boot_progmap
+#define DL_GET_READY_TO_RUN_EXTRA_ARGS \
+ , dl_boot_progmap
+
+
+
+
#ifdef __USE_GNU
# include <link.h>
#else
diff --git a/ldso/ldso/frv/elfinterp.c b/ldso/ldso/frv/elfinterp.c
index 2b2891880..9ab1a9777 100644
--- a/ldso/ldso/frv/elfinterp.c
+++ b/ldso/ldso/frv/elfinterp.c
@@ -153,10 +153,11 @@ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry)
DL_RELOC_ADDR (this_reloc->r_offset, tpnt->loadaddr);
/* Get the address to be used to fill in the GOT entry. */
- new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, 0,
+ new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, NULL, 0,
&new_tpnt);
if (!new_addr) {
- new_addr = _dl_find_hash_mod(symname, NULL, 0, &new_tpnt);
+ new_addr = _dl_find_hash_mod(symname, NULL, NULL, 0,
+ &new_tpnt);
if (!new_addr) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, symname);
@@ -278,7 +279,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
} else {
symbol_addr = (unsigned long)
- _dl_find_hash_mod(symname, scope, 0, &symbol_tpnt);
+ _dl_find_hash_mod(symname, scope, NULL, 0, &symbol_tpnt);
/*
* We want to allow undefined references to weak symbols - this might
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 2da54e0a7..7f65128c4 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -31,7 +31,7 @@ XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I$(TOPDIR)ldso/ldso -I. -I$(TOPDIR)include
-XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
+XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
XXFLAGS_NOPIC:=$(XXFLAGS)
ifeq ($(DOPIC),y)
XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__
diff --git a/libc/sysdeps/linux/frv/Makefile b/libc/sysdeps/linux/frv/Makefile
index 858b15383..7f3347feb 100644
--- a/libc/sysdeps/linux/frv/Makefile
+++ b/libc/sysdeps/linux/frv/Makefile
@@ -23,7 +23,7 @@ ASFLAGS=$(CFLAGS)
CRT0_SRC = crt0.S
CRT0_OBJ = crt0.o crt1.o
-ifeq $(strip $(UCLIBC_PIE_SUPPORT)),y)
+ifeq ($(strip $(UCLIBC_PIE_SUPPORT)),y)
SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
endif
CRT0_DEPS=gmon-start.S