tccelf: Do not load all referenced libraries when linking a library
Recursive loading of all references can break linking of libraries (Example: building of netbsd-curses) Thanks grischka, Michael and Herman for the comments. -- Regards ... Detlef
This commit is contained in:
parent
6b967b1285
commit
32c4df1497
1 changed files with 12 additions and 3 deletions
15
tccelf.c
15
tccelf.c
|
@ -3554,9 +3554,9 @@ static void store_version(TCCState *s1, struct versym_info *v, char *dynstr)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* load a DLL and all referenced DLLs. 'level = 0' means that the DLL
|
||||
is referenced by the user (so it should be added as DT_NEEDED in
|
||||
the generated ELF file) */
|
||||
/* load a library / DLL
|
||||
'level = 0' means that the DLL is referenced by the user
|
||||
(so it should be added as DT_NEEDED in the generated ELF file) */
|
||||
ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
|
||||
{
|
||||
ElfW(Ehdr) ehdr;
|
||||
|
@ -3649,6 +3649,14 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
|
|||
}
|
||||
}
|
||||
|
||||
/* do not load all referenced libraries
|
||||
(recursive loading can break linking of libraries) */
|
||||
/* following DT_NEEDED is needed for the dynamic loader (libdl.so),
|
||||
but it is no longer needed, when linking a library or a program.
|
||||
When tcc output mode is OUTPUT_MEM,
|
||||
tcc calls dlopen, which handles DT_NEEDED for us */
|
||||
|
||||
#if 0
|
||||
for(i = 0, dt = dynamic; i < nb_dts; i++, dt++)
|
||||
if (dt->d_tag == DT_RPATH)
|
||||
tcc_add_library_path(s1, dynstr + dt->d_un.d_val);
|
||||
|
@ -3666,6 +3674,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret_success:
|
||||
ret = 0;
|
||||
|
|
Loading…
Reference in a new issue