diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-12-05 20:24:26 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-12-05 20:24:26 +0000 |
commit | 91a32cb9815ca525726168750566d9acdb099a73 (patch) | |
tree | 212c2f637f22b0e4b56fac1f5c510657df6c241f | |
parent | 386eee7b494be91e20fdd760bc01b20534e5fa7b (diff) |
move _dl_fixup so staticly linked apps using dlopen have a
chance of actually working
-rw-r--r-- | ldso/ldso/dl-elf.c | 66 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 65 | ||||
-rw-r--r-- | ldso/ldso/readelflib1.c | 66 |
3 files changed, 132 insertions, 65 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index a99513700..cb6c6893b 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -903,3 +903,69 @@ void *_dl_malloc(int size) return retval; } +int _dl_fixup(struct elf_resolve *tpnt, int flag) +{ + int goof = 0; + + if (tpnt->next) + goof += _dl_fixup(tpnt->next, flag); +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); +#endif + + if (tpnt->dynamic_info[DT_REL]) { +#ifdef ELF_USES_RELOCA +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(2, "%s: can't handle REL relocation records\n", _dl_progname); +#endif + goof++; + return goof; +#else + if (tpnt->init_flag & RELOCS_DONE) + return goof; + tpnt->init_flag |= RELOCS_DONE; + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_REL], + tpnt->dynamic_info[DT_RELSZ], 0); +#endif + } + if (tpnt->dynamic_info[DT_RELA]) { +#ifndef ELF_USES_RELOCA +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(2, "%s: can't handle RELA relocation records\n", _dl_progname); +#endif + goof++; + return goof; +#else + if (tpnt->init_flag & RELOCS_DONE) + return goof; + tpnt->init_flag |= RELOCS_DONE; + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_RELA], + tpnt->dynamic_info[DT_RELASZ], 0); +#endif + } + if (tpnt->dynamic_info[DT_JMPREL]) { + if (tpnt->init_flag & JMP_RELOCS_DONE) + return goof; + tpnt->init_flag |= JMP_RELOCS_DONE; + if (flag & RTLD_LAZY) { + _dl_parse_lazy_relocation_information(tpnt, + tpnt->dynamic_info[DT_JMPREL], + tpnt->dynamic_info [DT_PLTRELSZ], 0); + } else { + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_JMPREL], + tpnt->dynamic_info[DT_PLTRELSZ], 0); + } + } +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) { + _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); + _dl_dprintf(_dl_debug_file,"; finished\n\n"); + } +#endif + return goof; +} + + diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index e9f773f4a..a5826b671 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -1259,71 +1259,6 @@ void _dl_debug_state(void) { } -int _dl_fixup(struct elf_resolve *tpnt, int flag) -{ - int goof = 0; - - if (tpnt->next) - goof += _dl_fixup(tpnt->next, flag); -#if defined (__SUPPORT_LD_DEBUG__) - if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); -#endif - - if (tpnt->dynamic_info[DT_REL]) { -#ifdef ELF_USES_RELOCA -#if defined (__SUPPORT_LD_DEBUG__) - if(_dl_debug) _dl_dprintf(2, "%s: can't handle REL relocation records\n", _dl_progname); -#endif - goof++; - return goof; -#else - if (tpnt->init_flag & RELOCS_DONE) - return goof; - tpnt->init_flag |= RELOCS_DONE; - goof += _dl_parse_relocation_information(tpnt, - tpnt->dynamic_info[DT_REL], - tpnt->dynamic_info[DT_RELSZ], 0); -#endif - } - if (tpnt->dynamic_info[DT_RELA]) { -#ifndef ELF_USES_RELOCA -#if defined (__SUPPORT_LD_DEBUG__) - if(_dl_debug) _dl_dprintf(2, "%s: can't handle RELA relocation records\n", _dl_progname); -#endif - goof++; - return goof; -#else - if (tpnt->init_flag & RELOCS_DONE) - return goof; - tpnt->init_flag |= RELOCS_DONE; - goof += _dl_parse_relocation_information(tpnt, - tpnt->dynamic_info[DT_RELA], - tpnt->dynamic_info[DT_RELASZ], 0); -#endif - } - if (tpnt->dynamic_info[DT_JMPREL]) { - if (tpnt->init_flag & JMP_RELOCS_DONE) - return goof; - tpnt->init_flag |= JMP_RELOCS_DONE; - if (flag & RTLD_LAZY) { - _dl_parse_lazy_relocation_information(tpnt, - tpnt->dynamic_info[DT_JMPREL], - tpnt->dynamic_info [DT_PLTRELSZ], 0); - } else { - goof += _dl_parse_relocation_information(tpnt, - tpnt->dynamic_info[DT_JMPREL], - tpnt->dynamic_info[DT_PLTRELSZ], 0); - } - } -#if defined (__SUPPORT_LD_DEBUG__) - if(_dl_debug) { - _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); - _dl_dprintf(_dl_debug_file,"; finished\n\n"); - } -#endif - return goof; -} - char *_dl_getenv(const char *symbol, char **envp) { char *pnt; diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index a99513700..cb6c6893b 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -903,3 +903,69 @@ void *_dl_malloc(int size) return retval; } +int _dl_fixup(struct elf_resolve *tpnt, int flag) +{ + int goof = 0; + + if (tpnt->next) + goof += _dl_fixup(tpnt->next, flag); +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); +#endif + + if (tpnt->dynamic_info[DT_REL]) { +#ifdef ELF_USES_RELOCA +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(2, "%s: can't handle REL relocation records\n", _dl_progname); +#endif + goof++; + return goof; +#else + if (tpnt->init_flag & RELOCS_DONE) + return goof; + tpnt->init_flag |= RELOCS_DONE; + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_REL], + tpnt->dynamic_info[DT_RELSZ], 0); +#endif + } + if (tpnt->dynamic_info[DT_RELA]) { +#ifndef ELF_USES_RELOCA +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) _dl_dprintf(2, "%s: can't handle RELA relocation records\n", _dl_progname); +#endif + goof++; + return goof; +#else + if (tpnt->init_flag & RELOCS_DONE) + return goof; + tpnt->init_flag |= RELOCS_DONE; + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_RELA], + tpnt->dynamic_info[DT_RELASZ], 0); +#endif + } + if (tpnt->dynamic_info[DT_JMPREL]) { + if (tpnt->init_flag & JMP_RELOCS_DONE) + return goof; + tpnt->init_flag |= JMP_RELOCS_DONE; + if (flag & RTLD_LAZY) { + _dl_parse_lazy_relocation_information(tpnt, + tpnt->dynamic_info[DT_JMPREL], + tpnt->dynamic_info [DT_PLTRELSZ], 0); + } else { + goof += _dl_parse_relocation_information(tpnt, + tpnt->dynamic_info[DT_JMPREL], + tpnt->dynamic_info[DT_PLTRELSZ], 0); + } + } +#if defined (__SUPPORT_LD_DEBUG__) + if(_dl_debug) { + _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname); + _dl_dprintf(_dl_debug_file,"; finished\n\n"); + } +#endif + return goof; +} + + |