Jump to content

simple test case with SC_THREAD crashes on a debug aarch64 build.


vasu_c

Recommended Posts

HI,

I am seeing a crash with an aarch64 debug SystemC-2.3.2 build (built using gcc-5.4.0). The crash is somewhere in the quickthreads code.

Would appreciate any help resolving this. 

Below is the test case I am using with gcc-5.4.0

#include "systemc.h"

SC_MODULE(top)
{

  void thread() {
        cout << "thread executing ..." << endl;
  }

  SC_CTOR(top) {
      SC_THREAD(thread);
  }

};

int sc_main(int argc, char** argv)
{
        top t1("t1");
        sc_start(10, SC_NS);
        return 0;
}
Thanks

 

Link to comment
Share on other sites

I don't see anything wrong with the code, but I don't have access to this platform.  The aarch64 platform support has been contributed newly in SystemC 2.3.2 and has only been tested with GCC 4.5.0 so far.

  • Can you provide more more details about the crash? (e.g. backtrace, build logs for library and application - including all command-line invocations, ...)

  • Do you see any compiler warnings during the library/model build?

  • Does it help to switch to the pthreads-based process implementation (../configure --enable-pthreads ...)?

Greetings from Duisburg,
  Philipp

Link to comment
Share on other sites

Thanks for the quick response Philipp.

Configuration options for the library:

../configure --prefix=/path/to/install --enable-debug --disable-silent-rules --disable-optimize

The only warning that stands out is :

libtool: compile:  g++ -DSC_INCLUDE_FX -DSC_BUILD -I. -I../../../src/sysc -I../../../src -Wall -g -pthread -MT kernel/sc_thread_process.lo -MD -MP -MF kernel/.deps/sc_thread_process.Tpo -c ../../../src/sysc/kernel/sc_thread_process.cpp  -fPIC -DPIC -o kernel/.libs/sc_thread_process.o
../../../src/sysc/kernel/sc_thread_process.cpp:107:34: warning: 'force_align_arg_pointer' attribute directive ignored [-Wattributes]
 void sc_thread_cor_fn( void* arg )

 

The other warning that I see is (i think i can safely ignore this)

libtool: link: warning: library `/u/prod/gnu/gcc/20180108/gcc-5.4.0-linux_aarch64/bin/../lib/gcc/aarch64-unknown-linux-gnu/5.4.0/../../../../lib64/libstdc++.la' was moved.
 

The build log file for the library is greater than 0.49 Mb hence I am unable to attach it.

Stack trace:

Unfortunately there is nothing in the stack trace, but on single stepping through the instructions in "aarch64.s"

 77     ldp d8,  d9,  [sp, #-160] <-- it is this line that eventually leads to thecrash
 78 
 79 _qt_align:
 80 qt_align:
 81     ret
 

gdb stack trace:

        SystemC 2.3.2-Accellera --- Apr 10 2018 11:05:10
        Copyright (c) 1996-2017 by all Contributors,
        ALL RIGHTS RESERVED

Program received signal SIGSEGV, Segmentation fault.
0x0000ffffffffe440 in ?? ()
(gdb) where
#0  0x0000ffffffffe440 in ?? ()
#1  0x0000ffffffffe440 in ?? ()
 

I don't have gcc-4.5.0 built, but will try that as well.

Thanks again for the response. Appreciate it.

Regards.

Link to comment
Share on other sites

Hi @vasu_c, thanks for finding this. The patch below should fix your issue if you want to try it out early. Apologies for the inconvenience.

--- a/src/sysc/packages/qt/md/aarch64.s
+++ b/src/sysc/packages/qt/md/aarch64.s
@@ -59,8 +59,10 @@ qt_blocki:
     mov x0, sp  // arg0 = old_sp
     mov sp, x3  // sp = new_sp
 
+    sub sp, sp, 160
     // (*helper)(old_sp, a0, a1)
     blr x4
+    add sp, sp, 160
 
     // Callee-saved
     ldp x29, x30, [sp, #-16]  // frame, link

 

Link to comment
Share on other sites

On 5/21/2018 at 11:51 AM, Joshua Landau said:

Hi @vasu_c, thanks for finding this. The patch below should fix your issue if you want to try it out early. Apologies for the inconvenience.


--- a/src/sysc/packages/qt/md/aarch64.s
+++ b/src/sysc/packages/qt/md/aarch64.s
@@ -59,8 +59,10 @@ qt_blocki:
     mov x0, sp  // arg0 = old_sp
     mov sp, x3  // sp = new_sp
 
+    sub sp, sp, 160
     // (*helper)(old_sp, a0, a1)
     blr x4
+    add sp, sp, 160
 
     // Callee-saved
     ldp x29, x30, [sp, #-16]  // frame, link

 

Than you Joshua. I missed this update.

Just applied the patch and it works fine.

Appreciate the help.

Link to comment
Share on other sites

On 5/20/2018 at 11:36 PM, AmeyaVS said:

Hello @vasu_c,

Can you let us know what platform you are using for the AArch64 build? and also, if possible the ABI specifications of the GCC compiler as well?

Thanks and Regards,

Ameya Vikram Singh

Ameya,

I was using "CentOS Linux release 7.4.1708 (AltArch)" for the aarch64 build.

Here is the ABI specification for gcc-5.4.0 that I was using.

#define __GXX_ABI_VERSION 1009

Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...