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
Unified · Split
| @@ -3554,9 +3554,9 @@ static void store_version(TCCState *s1, struct versym_info *v, char *dynstr) · 3553 unmodified lines | |||
| 3554 | #endif | 3554 | #endif |
| 3555 | } | 3555 | } |
| 3556 | 3556 | ||
| 3557 | /* load a DLL and all referenced DLLs. 'level = 0' means that the DLL | 3557 | /* load a library / DLL |
| 3558 | is referenced by the user (so it should be added as DT_NEEDED in | 3558 | '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) */ |
| 3560 | ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) | 3560 | ST_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; |