bugAVR C Runtime Library - Bugs: bug #44514, Wrong build option '-mtiny-stack'...


bug #44514: Wrong build option '-mtiny-stack' instead of '-msp8'

Submitted by:  Georg-Johann Lay <gjlayde>
Submitted on:  Wed 11 Mar 2015 07:37:20 PM UTC  
Category:  Build Infrastructure Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build system
Status:  Fixed Percent Complete:  100%
Assigned to:  Senthil Kumar Selvaraj <saaadhu> Open/Closed:  Open
Release:  1.8.0 Fixed Release:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 18 Mar 2015 06:55:04 AM UTC, comment #1: 
Senthil Kumar Selvaraj <saaadhu>
Project MemberIn charge of this item.
Wed 11 Mar 2015 07:37:20 PM UTC, original submission:  

Libraries are being built with a wrong option -mtiny-stack:


CFLAGS_TINY_STACK="-mtiny-stack -mcall-prologues -Os"

To query avr-gcc for it's multilib layout, use -print-multi-lib:

$ avr-gcc -print-multi-lib

For each line:  Left of ';' stands the multilib subdir, right of ';' are the option(s) to select that multilib subdir (replace '@' with ' -' to get the option(s)).

Notice that -mtiny-stack is not an avr-gcc multilib option!  The correct option is -msp8.

In order to query for the multilib subdir for a specific set of command options, use

$ avr-gcc -print-multi-directory <options>


$ avr-gcc -print-multilib -mmcu=avr2 -msp8 -Os

'-Os' is ignored (no multilib option)
'-mmcu=avr2' is the default multilib, hence will yield '.'.
'-msp8' selects the tiny-stack subdir for avr2 and the result is './tiny-stack' i.e. 'tiny-stack'.

Also notice that apart from their multilib properties, -msp8 and -mtiny-stack are working differently:

  • -msp8 asserts that the stack pointer (SP) is 8 bits wide physically.  avr-gcc will set -msp8 as needed except for the cases -mmcu=avr2 and -mmcu=avr25.  These are the only core architectures which intermix devices with 16-bit wide and 8-bit wide SP.  Or, to put it more precisely:  avr-gcc uses -msp8 to decomposes these to sets of devices into 4 core architectures.
  • -mtiny-stack is an optimization option:  Only the lower 8 bits of SP will be changed, no matter how SP is layed out physically.  This applies to all devices and archirectures.
Georg-Johann Lay <gjlayde>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #33357:  flags.patch added by saaadhu (453B - text/x-patch - Use msp8 instead of mtiny-stack)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by saaadhu (Updated the item)
  • -email is unavailable- added by gjlayde (Submitted the item)



    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-18 saaadhu StatusNone => Fixed
        Percent Complete0% => 100%
    2015-03-16 saaadhu Attached File- => Added flags.patch, #33357
        Assigned toNone => saaadhu

    Back to the top

    Powered by Savane 3.5