{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/7596","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/7596/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/7596/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/7596/events","html_url":"https://github.com/ARMmbed/mbed-os/pull/7596","id":344584379,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzOTQ1NTkz","number":7596,"title":"Add link-time optimization flag [DO NOT MERGE!!]","user":{"login":"mikisch81","id":14541274,"node_id":"MDQ6VXNlcjE0NTQxMjc0","avatar_url":"https://avatars2.githubusercontent.com/u/14541274?v=4","gravatar_id":"","url":"https://api.github.com/users/mikisch81","html_url":"https://github.com/mikisch81","followers_url":"https://api.github.com/users/mikisch81/followers","following_url":"https://api.github.com/users/mikisch81/following{/other_user}","gists_url":"https://api.github.com/users/mikisch81/gists{/gist_id}","starred_url":"https://api.github.com/users/mikisch81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikisch81/subscriptions","organizations_url":"https://api.github.com/users/mikisch81/orgs","repos_url":"https://api.github.com/users/mikisch81/repos","events_url":"https://api.github.com/users/mikisch81/events{/privacy}","received_events_url":"https://api.github.com/users/mikisch81/received_events","type":"User","site_admin":false},"labels":[{"id":407548740,"node_id":"MDU6TGFiZWw0MDc1NDg3NDA=","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/do%20not%20merge","name":"do not merge","color":"b60205","default":false},{"id":144902129,"node_id":"MDU6TGFiZWwxNDQ5MDIxMjk=","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/needs:%20work","name":"needs: work","color":"fbca04","default":false},{"id":1140603246,"node_id":"MDU6TGFiZWwxMTQwNjAzMjQ2","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/release-version:%205.11.1","name":"release-version: 5.11.1","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2018-07-25T19:55:31Z","updated_at":"2018-12-11T02:05:18Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/7596","html_url":"https://github.com/ARMmbed/mbed-os/pull/7596","diff_url":"https://github.com/ARMmbed/mbed-os/pull/7596.diff","patch_url":"https://github.com/ARMmbed/mbed-os/pull/7596.patch"},"body":"## Description\r\n\r\nAs part of the Mbed hackaton effort to reduce code size of mbed-os & mbed-cloud-client link-time optimization can help.\r\n\r\nGCC: `-flto` flag was added to the compiler and to the linker.\r\nARMC6: `-flto` flag was added to the compiler and `--lto` to the linker.\r\n\r\nIt was tested with [simple-mbed-cloud-client](https://github.com/ARMmbed/simple-mbed-cloud-client-template-restricted), did not checked mbed-os tests yet.\r\n\r\n* It was tested with ARM_GCC compiler version 7.3.1 and ARM compiler version 6.9.\r\n* ARM_GCC compiler version 6.x.x doesn't work, see [https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86490](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86490).\r\n* Minus side is that the memory statistics no longer works so you can't see the each module memory usage anymore.\r\n* IAR is still in the todo-list.. (use --mfc there)\r\n\r\n### ARM_GCC\r\n\r\n#### Without Link-Time optimization\r\n\r\n```bash\r\n+-------------------------------------------------------+------------+----------+-----------+\r\n| Module                                                |      .text |    .data |      .bss |\r\n+-------------------------------------------------------+------------+----------+-----------+\r\n| [fill]                                                |    750(+0) |   14(+0) |  2208(+0) |\r\n| [lib]/c.a                                             |  56355(+0) | 2572(+0) |   127(+0) |\r\n| [lib]/gcc.a                                           |   7420(+0) |    0(+0) |     0(+0) |\r\n| [lib]/misc                                            |    204(+0) |    4(+0) |    28(+0) |\r\n| [lib]/nosys.a                                         |     32(+0) |    0(+0) |     0(+0) |\r\n| [lib]/stdc++.a                                        |   6920(+0) |    8(+0) |    44(+0) |\r\n| main.o                                                |   3716(+0) |    0(+0) |   712(+0) |\r\n| mbed-os/drivers                                       |   2188(+0) |    0(+0) |    84(+0) |\r\n| mbed-os/events                                        |   1768(+0) |    0(+0) |  3152(+0) |\r\n| mbed-os/features                                      | 153032(+0) |  198(+0) | 52842(+0) |\r\n| mbed-os/hal                                           |   1600(+0) |    4(+0) |    68(+0) |\r\n| mbed-os/platform                                      |   3565(+0) |  276(+0) |   642(+0) |\r\n| mbed-os/rtos                                          |  14896(+0) |  168(+0) |  6593(+0) |\r\n| mbed-os/targets                                       |  12279(+0) |   12(+0) |   533(+0) |\r\n| mbed_cloud_dev_credentials.o                          |   1541(+0) |    0(+0) |     0(+0) |\r\n| sd-driver/SDBlockDevice.o                             |   3102(+0) |    0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/mbed-cloud-client            | 116185(+0) |  412(+0) |  6993(+0) |\r\n| simple-mbed-cloud-client/mbed_cloud_client_resource.o |   1207(+0) |    0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/resource.o                   |    558(+0) |    0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/simple-mbed-cloud-client.o   |   3509(+0) |    0(+0) |     8(+0) |\r\n| simple-mbed-cloud-client/update_ui_example.o          |    444(+0) |    0(+0) |     6(+0) |\r\n| update_default_resources.o                            |     73(+0) |    0(+0) |     0(+0) |\r\n| Subtotals                                             | 391344(+0) | 3668(+0) | 74040(+0) |\r\n+-------------------------------------------------------+------------+----------+-----------+\r\nTotal Static RAM memory (data + bss): 77708(+0) bytes\r\nTotal Flash memory (text + data): 395012(+0) bytes\r\n```\r\n\r\n#### With Link-Time optimization (diff is from not-optimized image)\r\n\r\n```bash\r\n+-------------------------------------------------------+-----------------+------------+---------------+\r\n| Module                                                |           .text |      .data |          .bss |\r\n+-------------------------------------------------------+-----------------+------------+---------------+\r\n| ../..                                                 | 285178(+285178) |  939(+939) | 71540(+71540) |\r\n| BUILD/K64F                                            |       904(+904) |      0(+0) |         0(+0) |\r\n| [fill]                                                |       131(-619) |     13(-1) |     2145(-63) |\r\n| [lib]/c.a                                             |       56355(+0) |   2572(+0) |       127(+0) |\r\n| [lib]/gcc.a                                           |        7420(+0) |      0(+0) |         0(+0) |\r\n| [lib]/misc                                            |         204(+0) |      0(-4) |        28(+0) |\r\n| [lib]/nosys.a                                         |          32(+0) |      0(+0) |         0(+0) |\r\n| [lib]/stdc++.a                                        |        6919(-1) |      8(+0) |        44(+0) |\r\n| main.o                                                |        0(-3716) |      0(+0) |       0(-712) |\r\n| mbed-os/drivers                                       |        0(-2188) |      0(+0) |        0(-84) |\r\n| mbed-os/events                                        |        0(-1768) |      0(+0) |      0(-3152) |\r\n| mbed-os/features                                      |      0(-153032) |    0(-198) |     0(-52842) |\r\n| mbed-os/hal                                           |        0(-1600) |      0(-4) |        0(-68) |\r\n| mbed-os/platform                                      |        0(-3565) |    0(-276) |       0(-642) |\r\n| mbed-os/rtos                                          |       0(-14896) |    0(-168) |      0(-6593) |\r\n| mbed-os/targets                                       |       0(-12279) |     0(-12) |       0(-533) |\r\n| mbed_cloud_dev_credentials.o                          |        0(-1541) |      0(+0) |         0(+0) |\r\n| sd-driver/SDBlockDevice.o                             |        0(-3102) |      0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/mbed-cloud-client            |      0(-116185) |    0(-412) |      0(-6993) |\r\n| simple-mbed-cloud-client/mbed_cloud_client_resource.o |        0(-1207) |      0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/resource.o                   |         0(-558) |      0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/simple-mbed-cloud-client.o   |        0(-3509) |      0(+0) |         0(-8) |\r\n| simple-mbed-cloud-client/update_ui_example.o          |         0(-444) |      0(+0) |         0(-6) |\r\n| update_default_resources.o                            |          0(-73) |      0(+0) |         0(+0) |\r\n| Subtotals                                             |  357143(-34201) | 3532(-136) |   73884(-156) |\r\n+-------------------------------------------------------+-----------------+------------+---------------+\r\nTotal Static RAM memory (data + bss): 77416(-292) bytes\r\nTotal Flash memory (text + data): 360675(-34337) bytes\r\n```\r\n\r\n### ARMC6\r\n\r\n#### Without Link-Time optimization\r\n\r\n```bash\r\n+-------------------------------------------------------+------------+---------+-----------+\r\n| Module                                                |      .text |   .data |      .bss |\r\n+-------------------------------------------------------+------------+---------+-----------+\r\n| [lib]/c_wu.l                                          |  19347(+0) |  20(+0) |   392(+0) |\r\n| [lib]/fz_wm.l                                         |   1838(+0) |   0(+0) |     0(+0) |\r\n| [lib]/libcpp_wnu.l                                    |      1(+0) |   0(+0) |     0(+0) |\r\n| [lib]/libcppabi_wnu.l                                 |     44(+0) |   0(+0) |     0(+0) |\r\n| [lib]/m_wm.l                                          |    802(+0) |   0(+0) |     0(+0) |\r\n| anon$$obj.o                                           |     32(+0) |   0(+0) |  1024(+0) |\r\n| main.o                                                |   3783(+0) |   0(+0) |   720(+0) |\r\n| mbed-os/drivers                                       |   2041(+0) |   0(+0) |    84(+0) |\r\n| mbed-os/events                                        |   1905(+0) |   0(+0) |  3152(+0) |\r\n| mbed-os/features                                      | 158079(+0) | 240(+0) | 52966(+0) |\r\n| mbed-os/hal                                           |   1814(+0) |   4(+0) |    68(+0) |\r\n| mbed-os/platform                                      |   4636(+0) |  80(+0) |   549(+0) |\r\n| mbed-os/rtos                                          |  15787(+0) | 168(+0) |  7246(+0) |\r\n| mbed-os/targets                                       |  21943(+0) |  20(+0) |   477(+0) |\r\n| mbed_cloud_dev_credentials.o                          |   1541(+0) |   0(+0) |     0(+0) |\r\n| sd-driver/SDBlockDevice.o                             |   4443(+0) |   0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/mbed-cloud-client            | 118794(+0) | 377(+0) |  7042(+0) |\r\n| simple-mbed-cloud-client/mbed_cloud_client_resource.o |   1256(+0) |   0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/resource.o                   |    586(+0) |   0(+0) |     0(+0) |\r\n| simple-mbed-cloud-client/simple-mbed-cloud-client.o   |   3574(+0) |   0(+0) |     8(+0) |\r\n| simple-mbed-cloud-client/update_ui_example.o          |    395(+0) |   0(+0) |     6(+0) |\r\n| update_default_resources.o                            |     73(+0) |   0(+0) |     0(+0) |\r\n| Subtotals                                             | 362714(+0) | 909(+0) | 73734(+0) |\r\n+-------------------------------------------------------+------------+---------+-----------+\r\nTotal Static RAM memory (data + bss): 74643(+0) bytes\r\nTotal Flash memory (text + data): 363623(+0) bytes\r\n```\r\n\r\n#### With Link-Time optimization (diff is from not-optimized image)\r\n\r\n```bash\r\n+-------------------------------------------------------+-----------------+-----------+---------------+\r\n| Module                                                |           .text |     .data |          .bss |\r\n+-------------------------------------------------------+-----------------+-----------+---------------+\r\n| ../..                                                 | 306677(+306677) | 716(+716) | 72240(+72240) |\r\n| BUILD/K64F                                            |     1888(+1888) |     0(+0) |         0(+0) |\r\n| [lib]/c_wu.l                                          |     19965(+618) |    20(+0) |       392(+0) |\r\n| [lib]/fz_wm.l                                         |        1838(+0) |     0(+0) |         0(+0) |\r\n| [lib]/libcpp_wnu.l                                    |           0(-1) |     0(+0) |         0(+0) |\r\n| [lib]/libcppabi_wnu.l                                 |          44(+0) |     0(+0) |         0(+0) |\r\n| [lib]/m_wm.l                                          |         802(+0) |     0(+0) |         0(+0) |\r\n| anon$$obj.o                                           |          32(+0) |     0(+0) |      1024(+0) |\r\n| main.o                                                |        0(-3783) |     0(+0) |       0(-720) |\r\n| mbed-os/drivers                                       |        0(-2041) |     0(+0) |        0(-84) |\r\n| mbed-os/events                                        |        0(-1905) |     0(+0) |      0(-3152) |\r\n| mbed-os/features                                      |      0(-158079) |   0(-240) |     0(-52966) |\r\n| mbed-os/hal                                           |        0(-1814) |     0(-4) |        0(-68) |\r\n| mbed-os/platform                                      |        0(-4636) |    0(-80) |       0(-549) |\r\n| mbed-os/rtos                                          |       0(-15787) |   0(-168) |      0(-7246) |\r\n| mbed-os/targets                                       |       0(-21943) |    0(-20) |       0(-477) |\r\n| mbed_cloud_dev_credentials.o                          |        0(-1541) |     0(+0) |         0(+0) |\r\n| sd-driver/SDBlockDevice.o                             |        0(-4443) |     0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/mbed-cloud-client            |      0(-118794) |   0(-377) |      0(-7042) |\r\n| simple-mbed-cloud-client/mbed_cloud_client_resource.o |        0(-1256) |     0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/resource.o                   |         0(-586) |     0(+0) |         0(+0) |\r\n| simple-mbed-cloud-client/simple-mbed-cloud-client.o   |        0(-3574) |     0(+0) |         0(-8) |\r\n| simple-mbed-cloud-client/update_ui_example.o          |         0(-395) |     0(+0) |         0(-6) |\r\n| update_default_resources.o                            |          0(-73) |     0(+0) |         0(+0) |\r\n| Subtotals                                             |  331246(-31468) | 736(-173) |    73656(-78) |\r\n+-------------------------------------------------------+-----------------+-----------+---------------+\r\nTotal Static RAM memory (data + bss): 74392(-251) bytes\r\nTotal Flash memory (text + data): 331982(-31641) bytes\r\n```\r\n\r\n## Pull request type\r\n\r\n<!-- \r\n    Required\r\n    Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise).\r\n    Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front\r\n    of them would change the meaning incorrectly. The only changes to be made are to add a description text under the\r\n    description heading and to add a 'x' to the correct box.\r\n-->\r\n    [ ] Fix\r\n    [x] Refactor\r\n    [ ] New target\r\n    [ ] Feature\r\n    [ ] Breaking change\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/446045363","html_url":"https://github.com/ARMmbed/mbed-os/pull/7596#issuecomment-446045363","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/7596","id":446045363,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjA0NTM2Mw==","user":{"login":"cmonr","id":260086,"node_id":"MDQ6VXNlcjI2MDA4Ng==","avatar_url":"https://avatars1.githubusercontent.com/u/260086?v=4","gravatar_id":"","url":"https://api.github.com/users/cmonr","html_url":"https://github.com/cmonr","followers_url":"https://api.github.com/users/cmonr/followers","following_url":"https://api.github.com/users/cmonr/following{/other_user}","gists_url":"https://api.github.com/users/cmonr/gists{/gist_id}","starred_url":"https://api.github.com/users/cmonr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmonr/subscriptions","organizations_url":"https://api.github.com/users/cmonr/orgs","repos_url":"https://api.github.com/users/cmonr/repos","events_url":"https://api.github.com/users/cmonr/events{/privacy}","received_events_url":"https://api.github.com/users/cmonr/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T02:05:18Z","updated_at":"2018-12-11T02:05:18Z","author_association":"CONTRIBUTOR","body":"CI job stopped: `jenkins-ci/build-IAR`\r\n\r\nPrioritizing RC3 jobs for now. Will restart when able."}}
{"actor":{"display_login":"cmonr"}}