Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 29 of 29

Thread: Teensy 4.0 linker issues with STL libraries

  1. #26
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,225
    @Paul: in case you still read this thread: Would you accept a pull request to add weak definitions of the __throw_bad_XXX functions in the core?

  2. #27
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,464
    Yes when i made the function in previous libraries in past i made them weak, in case some other user code or library implemented their own.

  3. #28
    Junior Member
    Join Date
    May 2015
    Posts
    2
    I ran into the same problem. I got the errors
    Code:
    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/armv7e-m/fpu/fpv5-d16\libgcc.a(unwind-arm.o): In function `get_eit_entry':
    unwind-arm.c:(.text+0x134): undefined reference to `__exidx_end'
    unwind-arm.c:(.text+0x138): undefined reference to `__exidx_start'
    collect2.exe: error: ld returned 1 exit status
    Error compiling for board Teensy 4.0.
    However, the code was compiling just fine for the Teensy 3.2, 3.5 and 3.6. But when I switched to the Teensy 4.x these error messages started to appear.
    I was able to track down the problem and it seemed to occur when the vector.assign() function was being used multiple times with initializer lists.

    The following code reproduces the errors if compiled for teensy 4.x. Comment out any one of the two assign() lines, and it compiles just fine.
    Code:
    #include <initializer_list>
    #include <vector>
    
    class MyClass{
      public:
        void myFunc();
        std::vector<int> my_vector;
    };
    
    void MyClass::myFunc()
    {
      my_vector.assign(std::initializer_list<int>{3,5});
      my_vector.assign(std::initializer_list<int>{6,2});
    }
    
    void setup() {
      // put your setup code here, to run once:
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    }
    I was able to solve it by using the solution mentioned previously in this thread, in the beginning of the code.
    Code:
    extern "C"{
      __attribute__((weak)) int __exidx_start(){ return -1;}
      __attribute__((weak)) int __exidx_end(){ return -1; }
    }
    — but I'm still curious why the code breaks only for the teensy 4s and not previous teensies.

  4. #29
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,225
    but I'm still curious why the code breaks only for the teensy 4s and not previous teensies.
    The T4 linker skript misses the requred definitions for __exidx_start and __exidx_end. The skripts for T3.X have this definition. Here some more info: https://forum.pjrc.com/threads/59767...l=1#post230936

    Hopefully this will be fixed some time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •