• AVR Freaks

Hot!-G0 , but still small-data section exceeds 64KB; lower small-data size limit (see option -

Author
skeev
New Member
  • Total Posts : 15
  • Reward points : 0
  • Joined: 2018/11/08 10:27:03
  • Location: 0
  • Status: offline
2019/08/29 16:34:48 (permalink)
0

-G0 , but still small-data section exceeds 64KB; lower small-data size limit (see option -

I'm running xc32-gcc for a PIC32MX795F512L.
 
I added one unsigned integer variable to a rather badly-running program.
Until then, at least it built.
After the addition, I got the titular error message.
Separate definition statements for each.
I changed -G 64K to -G8.
No go.
Put new guy and a few others in the .data section.
Still no go.
Finally I went with -G0.
It still won't build.
Grrrr.
 
I've looked at the output to check whether -G0 was delivered to the linker.
It was.
 
I'm at a loss.
How do I fix this or at least
figure out what is going on?
 
 
 
#1

5 Replies Related Threads

    skeev
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2018/11/08 10:27:03
    • Location: 0
    • Status: offline
    Re: -G0 , but still small-data section exceeds 64KB; lower small-data size limit (see opti 2019/08/29 17:50:15 (permalink)
    0
    Apparently a solution is to also give the -G option to the compiler.
    Haven't tested giving the option just to the compiler.
    I *hate* just guessing.
    Even if it seems to work, even if it does work,
    one does not know what was supposed to happen.
    The error message came from the linker
    and made no mention of the compiler.
    Also --help listed -G for the linker,
    but not for the compiler.
    BTW what does the linker do with the option?
    Surely it doesn't need it to know about the .sbs section.
    #2
    andersm
    Super Member
    • Total Posts : 2675
    • Reward points : 0
    • Joined: 2012/10/07 14:57:44
    • Location: 0
    • Status: offline
    Re: -G0 , but still small-data section exceeds 64KB; lower small-data size limit (see opti 2019/08/29 23:11:43 (permalink)
    0
    https://sourceware.org/binutils/docs-2.32/ld/Options.html#index-_002dG-value
    https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/MIPS-Options.html#index-G-1791
     
    The linker has to generate the value for _gp, and and resolve the gp-relative relocations for small-data references. I don't know if the linker has the ability itself to move object into the small-data section.
    #3
    moser
    Super Member
    • Total Posts : 520
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: -G0 , but still small-data section exceeds 64KB; lower small-data size limit (see opti 2019/08/30 02:21:47 (permalink)
    0
    skeevApparently a solution is to also give the -G option to the compiler.
    Haven't tested giving the option just to the compiler.
    I *hate* just guessing.

     
    Well, if you *hate* just guessing then I recommend reading the available manuals before starting with guessing:
    • MPLAB® XC32 C/C++ Compiler User’s Guide
    • MPLAB® XC32 ASSEMBLER, LINKER AND UTILITIES User’s Guide
    You could have been successful: 
    MPLAB XC32 C/C++ Compiler User's Guide, 5.9.1 Options Specific to PIC32 Devices
    -G num
     
    Put global and static items less than or equal to num bytes into the small data or bss section instead of the normal data or bss section. This allows the data to be accessed using a single instruction.
    All modules should be compiled with the same -G num value.
    MPLAB XC32 C/C++ Compiler User's Guide, 4.5.1 XC32 (Global Options)
    Use GP relative addressing threshold

    Put definitions of externally-visible data in a small data section if that data is no bigger than num bytes.
     
    -G num

    In the linker user's guide you can just find a few comments about it, mostly pointing to the compiler.
     
     
    These manuals are often a good starting point. But of course, these manuals don't tell everything, and often are a bit confusing or even misleading. For example there are several options from the gcc tools, which fully work, but which are not described in the MPLAB manuals. So, there is nothing wrong with asking.
    #4
    skeev
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2018/11/08 10:27:03
    • Location: 0
    • Status: offline
    Re: -G0 , but still small-data section exceeds 64KB; lower small-data size limit (see opti 2019/08/30 08:24:38 (permalink)
    0
    Thanks moser.  That does take away the sting of just guessing.
     
    The error message came from the linker and *all*
    my web search results were about that message.
    By the time it occurred to me that a compiler option might be in order,
    I wasn't thinking too well.
    Whether I didn't look or looked and didn't find,
    I don't know.
    #5
    skeev
    New Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2018/11/08 10:27:03
    • Location: 0
    • Status: offline
    Re: -G0 , but still small-data section exceeds 64KB; lower small-data size limit (see opti 2019/08/30 08:42:35 (permalink)
    0
    andersm
    The linker has to generate the value for _gp, and and resolve the gp-relative relocations for small-data references. I don't know if the linker has the ability itself to move object into the small-data section.
    I'd expect that the linker would have to generate
    _gp iff .sdata was non-empty regardless of any option.


    For the linker to move things into .sdata would seem to be harmless.
    For it to be useful, I'd think that link time optimization would be necessary.
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5