summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-09-23 07:00:45 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-09-23 07:00:45 +0000
commitea64c4b3c6fbf77577b7019182bc93cabe21fdd5 (patch)
treef78beaaff3a65188212a70a4dc35f28b9208306f /ldso
parent6dfefd64985e6a6872aebf0c53a5f2c9da5b0da9 (diff)
Don't allow undefined global symbols to pass.
Move COPY relocs back to _dl_do_reloc().
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/arm/elfinterp.c18
-rw-r--r--ldso/ldso/frv/elfinterp.c10
-rw-r--r--ldso/ldso/m68k/elfinterp.c19
-rw-r--r--ldso/ldso/sh/elfinterp.c10
-rw-r--r--ldso/ldso/sh64/elfinterp.c16
-rw-r--r--ldso/ldso/sparc/elfinterp.c19
6 files changed, 34 insertions, 58 deletions
diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c
index cdf099d1f..9e0a6d702 100644
--- a/ldso/ldso/arm/elfinterp.c
+++ b/ldso/ldso/arm/elfinterp.c
@@ -285,8 +285,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
* have been intentional. We should not be linking local symbols
* here, so all bases should be covered.
*/
- if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) {
- goof++;
+ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
}
}
@@ -340,14 +342,8 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
*reloc_addr += (unsigned long) tpnt->loadaddr;
break;
case R_ARM_COPY:
-#if 0
- /* Do this later */
- _dl_dprintf(2, "Doing copy for symbol ");
- if (symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name);
- _dl_dprintf(2, "\n");
- _dl_memcpy((void *) symtab[symtab_index].st_value,
- (void *) symbol_addr, symtab[symtab_index].st_size);
-#endif
+ _dl_memcpy((void *) reloc_addr,
+ (void *) symbol_addr, symtab[symtab_index].st_size);
break;
default:
return -1; /*call _dl_exit(1) */
@@ -412,7 +408,7 @@ _dl_do_copy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long *reloc_addr;
unsigned long symbol_addr;
int goof = 0;
-
+ return 0; /* disable now, remove later */
reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
if (reloc_type != R_ARM_COPY)
diff --git a/ldso/ldso/frv/elfinterp.c b/ldso/ldso/frv/elfinterp.c
index bdf033bae..2b2891880 100644
--- a/ldso/ldso/frv/elfinterp.c
+++ b/ldso/ldso/frv/elfinterp.c
@@ -286,12 +286,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
* here, so all bases should be covered.
*/
- if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) {
-#if defined (__SUPPORT_LD_DEBUG__)
- _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n",
- symname, tpnt->libname);
-#endif
- return 0;
+ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
}
}
diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c
index 6e7ad6c5d..dc5713422 100644
--- a/ldso/ldso/m68k/elfinterp.c
+++ b/ldso/ldso/m68k/elfinterp.c
@@ -212,11 +212,11 @@ int _dl_parse_relocation_information(struct dyn_elf *rpnt,
linking local symbols here, so all bases should be
covered. */
if (!symbol_addr
- && ELF32_ST_BIND (symtab[symtab_index].st_info) == STB_GLOBAL)
+ && ELF32_ST_BIND (symtab[symtab_index].st_info) != STB_WEAK)
{
- _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
- _dl_progname, strtab + symtab[symtab_index].st_name);
- goof++;
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
}
}
switch (reloc_type)
@@ -254,16 +254,9 @@ int _dl_parse_relocation_information(struct dyn_elf *rpnt,
+ (rpnt->r_addend ? : *reloc_addr));
break;
case R_68K_COPY:
-#if 0 /* Do this later. */
- _dl_dprintf (2, "Doing copy");
- if (symtab_index)
- _dl_dprintf (2, " for symbol %s",
- strtab + symtab[symtab_index].st_name);
- _dl_dprintf (2, "\n");
- _dl_memcpy ((void *) symtab[symtab_index].st_value,
+ _dl_memcpy ((void *) reloc_addr,
(void *) symbol_addr,
symtab[symtab_index].st_size);
-#endif
break;
default:
_dl_dprintf (2, "%s: can't handle reloc type ", _dl_progname);
@@ -303,7 +296,7 @@ int _dl_parse_copy_information(struct dyn_elf *xpnt,
struct elf_resolve *tpnt;
int symtab_index;
/* Now parse the relocation information */
-
+ return 0; /* disable now, remove later */
tpnt = xpnt->dyn;
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);
diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c
index 3e4a36bac..821b44cbc 100644
--- a/ldso/ldso/sh/elfinterp.c
+++ b/ldso/ldso/sh/elfinterp.c
@@ -263,12 +263,10 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
* have been intentional. We should not be linking local symbols
* here, so all bases should be covered.
*/
- if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) {
-#if defined (__SUPPORT_LD_DEBUG__)
- _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s'\n",
- symname, tpnt->libname);
-#endif
- return 0;
+ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
}
}
diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c
index 19d339ef7..3152881b3 100644
--- a/ldso/ldso/sh64/elfinterp.c
+++ b/ldso/ldso/sh64/elfinterp.c
@@ -315,13 +315,10 @@ static int _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope,
*/
stb = ELF32_ST_BIND(symtab[symtab_index].st_info);
- if (stb == STB_GLOBAL && !symbol_addr) {
-#ifdef __SUPPORT_LD_DEBUG__
- _dl_dprintf(2, "\tglobal symbol '%s' "
- "already defined in '%s'\n",
- symname, tpnt->libname);
-#endif
- return 0;
+ if (stb != STB_WEAK && !symbol_addr) {
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
}
}
@@ -333,7 +330,8 @@ static int _dl_do_reloc(struct elf_resolve *tpnt,struct dyn_elf *scope,
case R_SH_NONE:
break;
case R_SH_COPY:
- /* handled later on */
+ _dl_memcpy((char *)reloc_addr,
+ (char *)symbol_addr, symtab[symtab_index].st_size);
break;
case R_SH_DIR32:
case R_SH_GLOB_DAT:
@@ -464,7 +462,7 @@ static int _dl_do_copy_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
unsigned long symbol_addr;
char *symname;
int goof = 0;
-
+ return 0; /* disable now, remove later */
reloc_addr = (unsigned long *)(intptr_t)
(tpnt->loadaddr + (unsigned long)rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c
index 543489fc1..89993cd84 100644
--- a/ldso/ldso/sparc/elfinterp.c
+++ b/ldso/ldso/sparc/elfinterp.c
@@ -219,10 +219,10 @@ int _dl_parse_relocation_information(struct dyn_elf *rpnt,
tpnt->symbol_scope, elf_machine_type_class(reloc_type));
if(!symbol_addr &&
- ELF32_ST_BIND(symtab [symtab_index].st_info) == STB_GLOBAL) {
- _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
- _dl_progname, strtab + symtab[symtab_index].st_name);
- goof++;
+ ELF32_ST_BIND(symtab [symtab_index].st_info) != STB_WEAK) {
+ _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
+ _dl_progname, strtab + symtab[symtab_index].st_name);
+ _dl_exit (1);
};
};
switch(reloc_type){
@@ -263,14 +263,7 @@ int _dl_parse_relocation_information(struct dyn_elf *rpnt,
((symbol_addr - (unsigned int) reloc_addr) >> 2);
break;
case R_SPARC_COPY:
-#if 0 /* This one is done later */
- _dl_dprintf(2, "Doing copy for symbol ");
- if(symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name);
- _dl_dprintf(2, "\n");
- _dl_memcpy((void *) symtab[symtab_index].st_value,
- (void *) symbol_addr,
- symtab[symtab_index].st_size);
-#endif
+ _dl_memcpy((void *) reloc_addr, (void *) symbol_addr, symtab[symtab_index].st_size);
break;
default:
_dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname);
@@ -310,7 +303,7 @@ int _dl_parse_copy_information(struct dyn_elf *xpnt,
struct elf_resolve *tpnt;
int symtab_index;
/* Now parse the relocation information */
-
+ return 0; /* disable for now, remove later */
tpnt = xpnt->dyn;
rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr);