[EXT_EP-10812] Compiler ignores __attribute__((used)) Created: 11/Apr/22 Updated: 25/May/22 Resolved: 25/May/22 |
|
Status: | Fixed |
Project: | Embedded Software & Tools |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Medium |
Reporter: | TI User | Assignee: | TI User |
Resolution: | Fixed | Votes: | 0 |
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Product: | Code Generation Tools |
Internal ID: | CODEGEN-9834 |
Found In Release: | ARMCLANG_2.0.0.STS |
Fix In Release: | ARMCLANG_2.1.0.LTS* |
Affected Platform/Device: | default |
Workaround: | use __attribute__((retain)) This does the same thing on tiarmclang. |
Description |
Extract the attached zip file to an empty directory. The source file keep.c has this line ... static const int KEEP_VAR __attribute__((used)) = 0; Make changes to the Makefile as needed for path, or the host system, etc. Then build ... % gmake C:\ti\compilers\ti-cgt-armllvm_1.3.0.LTS\bin\tiarmclang -O3 -mcpu=cortex-m0 -Xlinker linker.cmd main.c keep.c -o old.out C:\ti\compilers\ti-cgt-armllvm_1.3.0.LTS\bin\tiarmobjdump --syms old.out | findstr KEEP_VAR 00000064 l O .rodata 00000004 KEEP_VAR C:\ti\compilers\ti-cgt-armllvm_2.0.0.STS\bin\tiarmclang -O3 -mcpu=cortex-m0 -Xlinker linker.cmd main.c keep.c -o new.out C:\ti\compilers\ti-cgt-armllvm_2.0.0.STS\bin\tiarmobjdump --syms new.out | findstr KEEP_VAR makefile:16: recipe for target 'check_new' failed gmake: *** [check_new] Error 1 The build with version 1.3.0.LTS keeps the variable KEEP_VAR. The build with version 2.0.0.STS does not. |