Menu

#2871 Symbol not previously defined: "_aligned_alloc"

open
None
PIC14
5
2019-11-02
2019-02-08
Roy Rankin
No

The definition of _aligned_alloc inline function in stdlib.h causes errors in 3.8.0 .
The error seen is

code2.asm:139:Error[113] Symbol not previously defined: "_aligned_alloc"
Error[181] System error while writing object file.

with command: sdcc-sdcc --use-non-free -mpic14 -p16f88 -c code2.c

Where code2.c is simply the following 2 lines:

#include <pic16f88.h>
#include <stdlib.h>

Discussion

  • Philipp Klaus Krause

    I suspect this is caused by the same underlying issue as bug [#2855].

    Philipp

     

    Related

    Bugs: #2855


    Last edit: Maarten Brock 2019-11-02
  • Philipp Klaus Krause

    Since bug #2855 is fixed, you might want to check, if this one is fixed, too.

     
  • Philipp Klaus Krause

    • status: open --> closed-out-of-date
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Since no further infromation was provided, I'll assume that this issue got fixed long ago.

     
  • Malcolm Swart

    Malcolm Swart - 2019-06-11

    Hi Philipp.

    I don't think this problem is fixed, I am using SDCC 3.9.0 and the MPLABx SDCC Plugin running on windows 10.

    When I compile this simple code:

    #include <stdio.h>
    #include <stdlib.h>
    #include <pic16f887.h>
    
    void main(void) {
    
        for (;;){
    
        }
    }
    

    I get this compiler error:

    build/default/production/test.asm:179:Error[113]   Symbol not previously defined: "_aligned_alloc"
    Error[181]   System error while writing object file.
    

    I have installed SDCC on my D drive instead of my C drive because there is more space, I have also checked all the environment paths and I can get the code to compile if I leave out <stdlib.h>

    Do you have any suggestions?

    Thanks for your time.

     

    Last edit: Malcolm Swart 2019-06-11
    • Philipp Klaus Krause

      It seems beside the now fixed aligned_alloc-specific bug [#2855] that affected multiple backends, there is another, pic14-specific problem affecting all inline functions.

      There currently is work on improving hte pic14 backend; it seems the issue will be fixed with that. It might take a bit of time, but I think the fix will be in trunk in a few weeks, and thus also in the next SDCC release.

      For details see the discussion on patch [patches:#303].

      Philipp

       

      Related

      Bugs: #2855
      Patches: #303


      Last edit: Maarten Brock 2019-11-02
      • Malcolm Swart

        Malcolm Swart - 2019-06-11

        Thanks for your feedback.

        I can confirm that for pic16 this not a problem, compiling the code was successful...

        Just abit off topic though, when compliling the same code for pic18f458 MPLAB says my symbol usage is already at 31% for the memory (used: 480b --> free:1056b).

        This seems odd to me as my code is not declaring any variables:

        #include <pic18f458.h>
        #include <stdio.h>
        #include <stdlib.h>
        
        
        void main(void) {
            for (;;) {
        
            }
        }
        

        Is there an explanation for this somewhere, in documentation or forum?
        Is there an alternative way of checking if MPLAB is correct?

        Thanks for your time.

         
        • Philipp Klaus Krause

          Unfortunately, I'm not familiar with the pic. For most SDCCbackends, the linker generates a .map file that contains information on memory usage. I guess the linker from gputils can create a similar file.

           
          • Malcolm Swart

            Malcolm Swart - 2019-06-11

            Ok looking at the .map file I see that most of the symbols defined is related to the special purpose registers, I guess the makes sense as a portion of the memory is defined as SPRs and then the rest is general purpose, another thing that is added is a stack, loop variables and a lookup address fo what ever reason.

            Thanks for your insight.

            Regards.

             
  • Philipp Klaus Krause

    • status: closed-out-of-date --> open
    • Category: other --> PIC14
     
  • Maarten Brock

    Maarten Brock - 2019-11-02
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -8,8 +8,7 @@
    
     Where code2.c is simply the following 2 lines:
    
    +~~~
     #include &lt;pic16f88.h&gt;
     #include &lt;stdlib.h&gt;
    -
    -
    -
    +~~~
    
     

Log in to post a comment.

Monday.com Logo