3246251196 / adtools_testing

1 stars 1 forks source link

Test 8 NEWLIB STATIC crashes inconsistently #5

Closed 3246251196 closed 1 year ago

3246251196 commented 1 year ago

https://easyupload.io/5zv337 (For self: ~/Desktop/stock_build_adt_tests.lha)

use_this_adtools="0"
gcc_ver="11"
binutils_ver="2.23.2"
expclib2_branch="v.1.0.0-beta10"
session_prefix="stock_build_"
gcc_path=""
adtools_repo_loc="https://github.com/sba1/adtools.git"
adtools_repo_branch=""

# ADTOOLS_MOD_SCRIPT="adtools_mod_clib2_June_2023"
EXP_CLIB2="1"
CLIB2_SHA1="v.1.0.0-beta10"
SDK_VERSION="54.16"
CROSS_PREFIX="/home/rjd/projects/adtools_testing/stock_build_build/adt_build"

export EXP_CLIB2
export CLIB2_SHA1
export SDK_VERSION
export CROSS_PREFIX

ADTOOLS commit: 0e9abdbab3bf2afa252d0542a83b1c16f40b379f CLIB2 commit: 28aa4eec565160d7fbe90cd534fc57542d921d65

MOD SCRIPT was:

#!/bin/bash --

set -x

# WHEN THIS SCRIPT IS INVOKED YOU ARE ALREADY INSIDE THE CHECKED OUT LOCATION OF ADTOOLS

# In the case we are not building with "experimental CLIB2" change
# nothing!
if (( EXP_CLIB2 )) # otherwise:
then
    # 1 - we add to the configure file that the library: libstdc++
    #     shall not generate functions for FLOAT/LONG math function
    #     since they are already provided in BETA10 CLIB2. Remove this
    #     if not using BETA10 or lower. June 2023.
    #
    #     This is does not affect the NEWLIB library! There is a
    #     conditional check for CLIB2 in this configure file
    configure_insert='  *amigaos*)\n      # RJD:\n      #\n      # When we build the cross compiler we define variables such as\n      # MULTILIB_OPTIONS (see 0001-Changes-for-AmigaOS-version-of-gcc.patch)\n      # which instructs the build to build for both NEWLIB and CLIB2. In the\n      # case that we are building experimental clib2 (AFXGROUP) we want to force\n      # the libstdc++ library to NOT define the following math functions since\n      # they are already in the C-library.\n      #\n      # To do this, we check that the EXP_CLIB2 option is set and that PWD\n      # contains "clib2". That way, we do not change anything for NEWLIB or\n      # "classic" CLIB2.\n      #\n      # TODO: Is there a better way to check this?\n      if [[ "${EXP_CLIB2}" == "1" && "${PWD}" =~ /clib2/ ]]\n      then\n     $as_echo "#define HAVE_ACOSF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ASINF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ATAN2F 1" >>confdefs.h\n\n   $as_echo "#define HAVE_ATANF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_CEILF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_COSF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_COSHF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_EXPF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_FABSF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_FLOORF 1" >>confdefs.h\n\n   $as_echo "#define HAVE_FMODF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_FREXPF 1" >>confdefs.h\n\n   $as_echo "#define HAVE_SQRTF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_HYPOTF 1" >>confdefs.h\n\n   $as_echo "#define HAVE_LDEXPF 1" >>confdefs.h\n\n   $as_echo "#define HAVE_LOG10F 1" >>confdefs.h\n\n   $as_echo "#define HAVE_LOGF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_MODFF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_POWF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_SINF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_SINHF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_TANF 1" >>confdefs.h\n\n     $as_echo "#define HAVE_TANHF 1" >>confdefs.h\n\n    $as_echo "#define HAVE_FABSL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ACOSL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ASINL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ATANL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_ATAN2L 1" >>confdefs.h\n\n   $as_echo "#define HAVE_CEILL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_COSL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_COSHL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_EXPL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_FLOORL 1" >>confdefs.h\n\n   $as_echo "#define HAVE_FMODL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_FREXPL 1" >>confdefs.h\n\n   $as_echo "#define HAVE_SQRTL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_HYPOTL 1" >>confdefs.h\n\n   $as_echo "#define HAVE_LDEXPL 1" >>confdefs.h\n\n   $as_echo "#define HAVE_LOGL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_LOG10L 1" >>confdefs.h\n\n   $as_echo "#define HAVE_MODFL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_POWL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_SINL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_SINHL 1" >>confdefs.h\n\n    $as_echo "#define HAVE_TANL 1" >>confdefs.h\n\n     $as_echo "#define HAVE_TANHL 1" >>confdefs.h\n      fi\n    ;;
'
    sed -i "29327i${configure_insert}" gcc/repo/libstdc++-v3/configure

    # 2 - The linker script from EXPCLIB2 needs to be used otherwise
    #     linking with shared objects is broken etc
    sed -i '115i\   cp downloads/clib2/misc/amigaos.h ../gcc/repo/gcc/config/rs6000/' native-build/makefile

    # 3 - We also want to build SHARED LIBRARIES for CLIB2
    sed -i 's|SHARED=no|SHARED=yes|' native-build/makefile

    # 4 - For CLIB2 we need to include the EntryData field when creating a new process
    sed -i '614i#ifdef CLIB2\nNP_EntryData, idos->GetEntryData(),\n#endif' gcc/repo/libgcc/gthr-amigaos-native.c
fi
3246251196 commented 1 year ago

This is with:

version full newlib.library
newlib.library 53.80 (06/04/2022)
3246251196 commented 1 year ago

For me, going into tests/8* and manually doing the steps make would have done results in an executable that passes on my X5000. Just noting this down.

3246251196 commented 1 year ago

Crashlog_New Process_2023-07-11_20-53-43.txt

We see that it is line 580 of gthr-amigaos-native.c:

static int __gthread_entry(STRPTR args UNUSED, int32 length UNUSED, APTR execbase UNUSED)
{
  struct Task *task;
  threadentry_t *thr;
  int i;

  /* Initialize libs */
  __gthread_once (&libs_once, init_libs);

  task = iexec->FindTask (NULL);
  thr = (threadentry_t *)((struct Process*)task)->pr_Task.tc_UserData;

  /* Wait for the parent task to enqueue the process in the global list */
  while (!(iexec->Wait (SIGBREAKF_CTRL_F) & SIGBREAKF_CTRL_F));

  thr->result = thr->entry(thr->args);

  /* Invoke destructors of all non-NULL thread specifics */
  iexec->ObtainSemaphore (&keystore->sem);
  for (i = 0; i < keystore->num_key_entries; i++)
    {
      void (*destroy)(void *);
      keyentry_t *key;

      if (!(destroy = keystore->keys[i].destroy))
        continue;

      if (!(key = find_keyentry (i, task)))
        continue;

      if (key->data)
        destroy ((void *)key->data); /* !!!! LINE 580 */
    }
  iexec->ReleaseSemaphore (&keystore->sem);

  __gthread_close_timer (thr);

  thr->finished = 1;
  return 0;
}
3246251196 commented 1 year ago

In the WebKit dev group: we believe that work must start on updating binutils due to issues with destructors!