Menu

#121 ChibiOS rtos detection fails with LTO enabled

0.9.0
closed
nobody
2017-01-11
2016-03-08
No

OpenOCD relies on the symbol 'chSysInit' being present to identify ChibiOS for rtos thread support. However, if link-time optimisation (LTO) is enabled for the ChibiOS build, as it is by default, this function may be inlined and its symbol dropped from the linked binary.

The symbols 'ch' and 'ch_debug' are also required (currently if 'ch' is found and 'ch_debug' is not, recognition of ChibiOS will fail with an info message) so the chances of a false positive would be resonably small even if the reliance on chSysInit were removed.

To recreate: Fresh build of OpenOCD 0.9.0, fresh build of the STM32F4DISCOVERY demo project from ChibiOS 14.1.4 using default settings. OpenOCD is unable to identify ChibiOS because the chSysInit symbol is missing from the binary.

Discussion

  • Paul Fertser

    Paul Fertser - 2016-03-08

    Hello,

    Thank you for the report.

    On Tue, Mar 08, 2016 at 11:36:25AM +0000, Andy Pomfret wrote:

    To recreate: Fresh build of OpenOCD 0.9.0, fresh build of the STM32F4DISCOVERY
    demo project from ChibiOS 14.1.4 using default settings. OpenOCD is unable to
    identify ChibiOS because the chSysInit symbol is missing from the binary.

    So do you basically suggest to remove chSysInit mentioning from
    OpenOCD altogether and rely solely on "ch"?

    --
    Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
    mailto:fercerpav@gmail.com

     
  • Andy Pomfret

    Andy Pomfret - 2016-03-08

    Yes, that would be my suggestion. I'm happy to submit a patch myself. Note that both 'ch' and 'ch_debug' are actually required for successful detection, which is good - I'd be nervous about relying on the presence of a single two-character symbol for the detection (false positives would be more likely).

     
    • Paul Fertser

      Paul Fertser - 2016-03-08

      On Tue, Mar 08, 2016 at 11:50:38AM +0000, Andy Pomfret wrote:

      Yes, that would be my suggestion. I'm happy to submit a patch
      myself.

      Please feel free then :)

       
      • Andy Pomfret

        Andy Pomfret - 2016-03-08

        Patch submitted (change 3381).

         

        Last edit: Andy Pomfret 2016-03-08
  • Spencer Oliver

    Spencer Oliver - 2017-01-11
    • status: new --> closed
     
  • Spencer Oliver

    Spencer Oliver - 2017-01-11

    gerrit patch merged.

     

Log in to post a comment.

MongoDB Logo MongoDB