apache / apache/nuttx

[QUESTION] Warnings when link with LTO

Open
#17,503 1 comment 0 reactions 1 assignee Claimed by @anchao View on GitHub
Community: Question
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 13h
Merged PRs (30d)
230

Description

### Description

I was trying to build code with GCC and LTO enabled. I observe link time warnings
```
lto-wrapper: warning: Extra option to '-Xassembler': -mthumb, dropping all '-Xassembler' and '-Wa' options.
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more information
```
I see that it is because of `ARCHOPTIMIZATION += -Wa,-mthumb` and `ARCHOPTIMIZATION += -Wa,-mimplicit-it=always` that were added by https://github.com/apache/nuttx/commit/9ab97df0a57 and https://github.com/apache/nuttx/commit/77aede7c87b

The https://github.com/apache/nuttx/commit/9ab97df0a57 has description from GCC 4.5.x and in later GCC versions I do not see description that requires explicit passing of `-mthumb` with `-Wa` option to assembler. Do we still target GCC 4.5.x support?

For https://github.com/apache/nuttx/commit/77aede7c87b I would like to reproduce an error if possible locally and check. I see that commit message references to ARM Clang, but `-Wa,-mimplicit-it=always` is passed without checking for `ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)`, so I would to better understand the issue and a way to fix it.

Additionally to above I do not see that we use `-mthumb-interwork` option and I would like to evaluate if we can fix any of above issues with Thumb interworking.

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.