History

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

Detlef Riekenberg committed 3 years ago

Commit 32c4df11 parent 6b967b11 file · +12 −3Browse files

Unified · Split

tccelf.c+12−3
@@ -3554,9 +3554,9 @@ static void store_version(TCCState *s1, struct versym_info *v, char *dynstr) · 3553 unmodified lines
3554#endif3554#endif
3555}3555}
3556 3556
3557/* load a DLL and all referenced DLLs. 'level = 0' means that the DLL3557/* load a library / DLL
3558 is referenced by the user (so it should be added as DT_NEEDED in3558 'level = 0' means that the DLL is referenced by the user
3559 the generated ELF file) */3559 (so it should be added as DT_NEEDED in the generated ELF file) */
3560ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)3560ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level)
3561{3561{
3562 ElfW(Ehdr) ehdr;3562 ElfW(Ehdr) ehdr;
@@ -3649,6 +3649,14 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) · 86 unmodified lines
3649 }3649 }
3650 }3650 }
3651 3651
3652 /* do not load all referenced libraries
3653 (recursive loading can break linking of libraries) */
3654 /* following DT_NEEDED is needed for the dynamic loader (libdl.so),
3655 but it is no longer needed, when linking a library or a program.
3656 When tcc output mode is OUTPUT_MEM,
3657 tcc calls dlopen, which handles DT_NEEDED for us */
3658
3659#if 0
3652 for(i = 0, dt = dynamic; i < nb_dts; i++, dt++)3660 for(i = 0, dt = dynamic; i < nb_dts; i++, dt++)
3653 if (dt->d_tag == DT_RPATH)3661 if (dt->d_tag == DT_RPATH)
3654 tcc_add_library_path(s1, dynstr + dt->d_un.d_val);3662 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) · 11 unmodified lines
3666 }3674 }
3667 }3675 }
3668 }3676 }
3677#endif
3669 3678
3670 ret_success:3679 ret_success:
3671 ret = 0;3680 ret = 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t