Skip to content

Commit

Permalink
Fix 'unresolved _end' linker error when targeting Android bitcode
Browse files Browse the repository at this point in the history
(a cherry-pick of commit b7676db from 'master')

If GC_DONT_REGISTER_MAIN_STATIC_DATA is defined but DYNAMIC_LOADING is
not, GC_register_data_segments will never be called.  However, the
function was still present and referenced symbols not present when
targeting bitcode.  If the linker did not remove the dead function,
linker errors occurred.  Stub an empty function in this case.

* os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32 && !AMIGA
&& !OPENBSD && !DYNAMIC_LOADING && GC_DONT_REGISTER_MAIN_STATIC_DATA]
(GC_register_data_segments): Change to no-op (do not use DATASTART and
DATAEND symbols).
  • Loading branch information
joncham authored and ivmai committed Mar 12, 2023
1 parent ebaaaf7 commit d076fa0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,11 @@ void GC_register_data_segments(void)

void GC_register_data_segments(void)
{
# if !defined(PCR) && !defined(MACOS)
# if !defined(DYNAMIC_LOADING) && defined(GC_DONT_REGISTER_MAIN_STATIC_DATA)
/* Avoid even referencing DATASTART and DATAEND as they are */
/* unnecessary and cause linker errors when bitcode is enabled. */
/* GC_register_data_segments() is not called anyway. */
# elif !defined(PCR) && !defined(MACOS)
# if defined(REDIRECT_MALLOC) && defined(GC_SOLARIS_THREADS)
/* As of Solaris 2.3, the Solaris threads implementation */
/* allocates the data structure for the initial thread with */
Expand Down

0 comments on commit d076fa0

Please sign in to comment.