0

Hello,

I had a problem with my old cross-compiler with the fPIC option, so I wanted to update it and that’s how I found this website and I tried the sh cross-compiler from here. But I don’t have the good file type although I have the same compiler option than before.

 

with old compiler, the file type that I want :

/appli/bin/test_pic: ELF 32-bit LSB  executable, Renesas SH, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

 

with new compiler, the file type that I obtain :

/appli/bin/test_pic: ELF 32-bit MSB  executable, Renesas SH, version 1 (SYSV), statically linked, not stripped

Why have I a MSB executable, and why the libs are statically linked ?

 

I work with Kubuntu as OS, I downloaded the package gnush_v13.01_elf-1-1.i386.rpm and installed it through “alien” command.

My target is SH-4a with an embedded linux:

cpu family      : sh4a
cpu type        : SH7723

 

Thank you for any help that you might bring

 

EDIT :

I’ve realized that the compiler don’t  generate multiple threads (Thread model : single). I will need multiple thread on my project (Thread model : posix). So if I’m not able to get multiple thread with the compiler, I can’t use it. Is there any solution this other problem ?

Thanks again.

Open Source Tools Support commented
    • Hello Olivier,

      Thank you for your feedback!

      This is a confirmation message to let you know that we have received your request and that we are looking into it as soon as possible.

      We will be getting back to you soon with our findings.


      Thank you,
      The GNU Tools Support Team

    • Hello Olivier,

      Thank you for you patience.

      Could you please send us the link to the website you are talking about? Regarding the problem about the MSB executables, we need more information to proceed forward: if possible, please attach a build log, or maybe a sample project demonstrating your issue.

      The compiler doesn’t generate multiple threads because all the toolchains that we build are delivered as “bare metal” (no specific OS support). Potentially, you could try building the SH toolchain v13.01 for Linux, and see if that resolves the issue.

      Should you need any further help, please let us know.


      Thank you,
      Erika Molnar
      The GNU Tools Support Team

    • Hello Erika,

      Thank YOU for your support.

      I’m sorry for the confusion, english is not my native langage, I was talking about your website : http://gcc-renesas.com

      The previous cross-compiler was provided to me by a subcontractor. It seems to be from sourcery

      ———————————————————————-

      Here is a sample that lead to the issue that I had with the old cross-compiler (similar to the situation I have in my real project) :


      class Test
      {
      public:
      Test();
      int test_function (double var_1, short var_2, short var_3, bool var_4, bool var_5, bool var_6);
      unsigned short m_member;
      };

      Test::Test() :
      m_member(1600)
      {
      }

      int Test::test_function (double var_1, short var_2, short var_3, bool var_4, bool var_5, bool var_6)
      {
      int result = 0;
      if (!var_4)
      {
      result = 1;
      }
      else if( var_6 )
      {
      result = 2;
      }
      else if ( var_2 m_member )
      {
      result = 3;
      }
      else if( ( var_5 == true ) || (var_3 >= (var_1 + 100.0) ) )
      {
      result = 4;
      }
      return result;
      }

      int main(int /*argc*/, char */*argv*/[])
      {
      double var_1 = 1105.5;
      short var_2 = 1600;
      short var_3 = 900;
      bool var_4 = true ;
      bool var_5 = false;
      bool var_6 = false;

      Test test;
      return test.test_function (var_1, var_2, var_3, var_4, var_5, var_6);
      }

      With my previous cross-compiler :
      output with -fPIE option : 0
      output with -fPIC option : 4
      expected output : 0

      ———————————————————————-

      That why I wanted to update my cross-compiler with the hope that resolve my problem, but it seems that renesas don’t provide a linux compiler, and kpit gnutools website (http://www.kpitgnutools.com/) redirect here.

      I can’t execute with your compiler because my device don’t seems to be able to read the executable.
      EDIT : When I try to execute, I get :
      ./test_pic: line 1: syntax error: unexpected “(”
      (yes, at execution time)

      There is no really build logs :

      (old compiler)
      sh-linux-gnu-g++ -O2 -fPIC main.cpp -o test_pic_old
      sh-linux-gnu-g++ -O2 -fPIE main.cpp -o test_pie_old

      (your compiler)
      sh-elf-g++ -O2 -fPIC main.cpp -o test_pic
      sh-elf-g++ -O2 -fPIE main.cpp -o test_pie

      with main.cpp is the sample code above.

      ———————————————————————-

      Here is the configuration of the cross-compilers :

      The previous one :
      Using built-in specs.
      Target: sh-linux-gnu
      Configured with: /scratch/ams/sh-10q3/lite/src/gcc-4.5-2010.09/configure –build=i686-pc-linux-gnu –host=i686-pc-linux-gnu –target=sh-linux-gnu –enable-threads –disable-libmudflap –disable-libssp –disable-libstdcxx-pch –with-cpu=sh4a –with-multilib-list= –with-endian=little,big –enable-extra-sgxxlite-multilibs –enable-incomplete-targets –with-gnu-as –with-gnu-ld –with-specs=’%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2010 -D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=45 %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}’ –enable-languages=c,c++ –enable-shared –enable-lto –enable-symvers=gnu –enable-__cxa_atexit –with-pkgversion=’Sourcery G++ Lite 2010.09-45′ –with-bugurl=https://support.codesourcery.com/GNUToolchain/ –disable-nls –prefix=/opt/codesourcery –with-sysroot=/opt/codesourcery/sh-linux-gnu/libc –with-build-sysroot=/scratch/ams/sh-10q3/lite/install/sh-linux-gnu/libc –with-gmp=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –with-mpfr=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –with-mpc=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –with-ppl=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –with-host-libstdcxx=’-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ –with-cloog=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –with-libelf=/scratch/ams/sh-10q3/lite/obj/host-libs-2010.09-45-sh-linux-gnu-i686-pc-linux-gnu/usr –disable-libgomp –enable-poison-system-directories –with-build-time-tools=/scratch/ams/sh-10q3/lite/install/sh-linux-gnu/bin –with-build-time-tools=/scratch/ams/sh-10q3/lite/install/sh-linux-gnu/bin
      Thread model: posix
      gcc version 4.5.1 (Sourcery G++ Lite 2010.09-45)

      your compiler :
      Using built-in specs.
      Target: sh-elf
      Configured with: /home/kpit/fsfsrc/elf-v13.01-src/gcc-4.7.2/configure –disable-shared –enable-sjlj-exceptions –enable-languages=c,c++ –target=sh-elf –with-newlib –with-gmp=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –with-mpfr=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –with-mpc=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –prefix=/usr/share/gnush_v13.01_elf-1 –enable-gold –enable-lto –disable-libstdcxx-pch : (reconfigured) /home/kpit/fsfsrc/elf-v13.01-src/gcc-4.7.2/configure –disable-shared –enable-sjlj-exceptions –enable-languages=c,c++ –target=sh-elf –with-newlib –with-gmp=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –with-mpfr=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –with-mpc=/home/kpit/pre-requisite/gcc-4.5.x/linux/prefix –prefix=/usr/share/gnush_v13.01_elf-1 –enable-gold –enable-lto –disable-libstdcxx-pch
      Thread model: single
      gcc version 4.7-GNUSH_v13.01 (GCC)

      ———————————————————————-

      I will try SH toolchain v13.01 because I need multiple thread.
      EDIT : I don’t understand, the toolchain that I got isn’t already the SH toolchain v13.01 for Linux ?

      If you need more information about my problem, feel free to ask again.
      Thank you.

    • Hello Olivier,

      Thank you for your feedback!

      This is a confirmation message to let you know that we have received your issue report and that we are looking into it as soon as possible.

      We will be getting back to you soon with our findings.


      Thank you,
      The GNU Tools Support Team

    • Hello Olivier,

      Thank you for your patience.

      >>I can’t execute with your compiler because my device don’t seems to be able to read the executable.

      The toolchains provided by us are bare metal (Target: sh-elf), meaning the output file is a platform specific file (elf) that contains information about startup code, the matching linker script, low-level initialization, etc. That file is supposed to run directly on a hardware without any support from an OS.
      The previous compiler you had creates output files specific to linux (Target: sh-linux-gnu). Those files are handled by OS, thus allowing you to have multi-threads.

      If you need any further assistance, please let us know.

      Best regards,
      Darius,
      The GNU Tools Support Team

    • Ok so it’s my bad, I tried a wrong usage of your compiler.

      I’m sorry to have bored you. I was really thinking that it was a compiler for a linux target (and a linux host).

      Thank you for your help.

      (PS : sorry, I flagged your comment by inadvertance and I can’t cancel that …)

    • Hi Olivier,

      No problem about the flagging or about the question.

      Should you require help building SH for Linux, please let us know and we will assist.


      Kind regards,
      The GNU Tools Support Team