提交 bc9b6ea0 编写于 作者: R Rich Felker

fix visibility mismatch in dynamic linker stage 2 function definition

since commits 2907afb8 and
6fc30c24, __dls2 is no longer called
via symbol lookup, but instead uses relative addressing that needs to
be resolved at link time. on some linker versions, and/or if
-Bsymbolic-functions is not used, the linker may leave behind a
dynamic relocation, which is not suitable for bootstrapping the
dynamic linker, if the reference to __dls2 is marked hidden but the
definition is not actually hidden. correcting the definition to use
hidden visibility fixes the problem.

the static-PIE entry point rcrt1 was likewise affected and is also
fixed by this patch.
上级 79789980
...@@ -9,6 +9,7 @@ void _fini() __attribute__((weak)); ...@@ -9,6 +9,7 @@ void _fini() __attribute__((weak));
_Noreturn int __libc_start_main(int (*)(), int, char **, _Noreturn int __libc_start_main(int (*)(), int, char **,
void (*)(), void(*)(), void(*)()); void (*)(), void(*)(), void(*)());
__attribute__((__visibility__("hidden")))
_Noreturn void __dls2(unsigned char *base, size_t *sp) _Noreturn void __dls2(unsigned char *base, size_t *sp)
{ {
__libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0); __libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
......
...@@ -1330,6 +1330,7 @@ static void update_tls_size() ...@@ -1330,6 +1330,7 @@ static void update_tls_size()
* linker itself, but some of the relocations performed may need to be * linker itself, but some of the relocations performed may need to be
* replaced later due to copy relocations in the main program. */ * replaced later due to copy relocations in the main program. */
__attribute__((__visibility__("hidden")))
void __dls2(unsigned char *base, size_t *sp) void __dls2(unsigned char *base, size_t *sp)
{ {
if (DL_FDPIC) { if (DL_FDPIC) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册