Is there a reason why not to use link-time optimization (LTO)?

后端 未结 5 1229
暖寄归人
暖寄归人 2020-12-05 06:31

GCC, MSVC, LLVM, and probably other toolchains have support for link-time (whole program) optimization to allow optimization of calls among compilation units.

Is the

5条回答
  •  囚心锁ツ
    2020-12-05 06:57

    Apart from to this,

    Consider a typical example from embedded system,

    void function1(void) { /*Do something*/} //located at address 0x1000 
    void function2(void) { /*Do something*/} //located at address 0x1100
    void function3(void) { /*Do something*/} //located at address 0x1200
    

    With predefined addressed functions can be called through relative addresses like bellow,

     (*0x1000)(); //expected to call function2
     (*0x1100)(); //expected to call function2
     (*0x1200)();  //expected to call function3
    

    LOT can lead to unexpected behavior.

提交回复
热议问题