0003-use-hidden-visibility-for-C-entry-point-function-_st.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 9c78557af0a5e521cdb46a4ca7630f2987d2523e Mon Sep 17 00:00:00 2001
  2. From: Rich Felker <dalias@aerifal.cx>
  3. Date: Sat, 10 Aug 2024 19:49:24 -0400
  4. Subject: [PATCH] use hidden visibility for C entry point function _start_c
  5. the file-level crt_arch.h asm fragments generally make direct
  6. (non-PLT) calls from _start to _start_c, which is only valid when
  7. there is a local, non-interposable definition for _start_c. generally,
  8. the linker is expected to know that local definitions in a main
  9. executable (as opposed to shared library) output are non-interposable,
  10. making this work, but historically there have been linker bugs in this
  11. area, and microblaze is reportedly still broken, flagging the
  12. relocation for the call as a textrel.
  13. the equivalent _dlstart_c, called from the same crt_arch.h asm
  14. fragments, has always used hidden visibility without problem, and
  15. semantically it should be hidden, so make it hidden. this ensures the
  16. direct call is always valid regardless of whether the linker properly
  17. special-cases main executable output.
  18. Upstream: https://git.musl-libc.org/cgit/musl/commit/?id=9c78557af0a5e521cdb46a4ca7630f2987d2523e
  19. Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
  20. ---
  21. crt/crt1.c | 2 +-
  22. 1 file changed, 1 insertion(+), 1 deletion(-)
  23. diff --git a/crt/crt1.c b/crt/crt1.c
  24. index 8fe8ab5d..10601215 100644
  25. --- a/crt/crt1.c
  26. +++ b/crt/crt1.c
  27. @@ -11,7 +11,7 @@ weak void _fini();
  28. int __libc_start_main(int (*)(), int, char **,
  29. void (*)(), void(*)(), void(*)());
  30. -void _start_c(long *p)
  31. +hidden void _start_c(long *p)
  32. {
  33. int argc = p[0];
  34. char **argv = (void *)(p+1);
  35. --
  36. 2.45.2