diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-10-28 19:07:52 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-10 23:03:19 +0000 |
commit | 0ef5b9815b2caf5fc3aa919e62129b4f757c0fe1 (patch) | |
tree | bdd240aff014fe0ce856458c5db4aac66e9662d5 | |
parent | 24aaeaca2bb673098fd762dcade55e740548a417 (diff) | |
download | chrome-ec-0ef5b9815b2caf5fc3aa919e62129b4f757c0fe1.tar.gz |
core/cortex-m0: fix vecttable.c when compiling with clang
This is the same as commit 0907090490b07357902927f089228d63a775cdf0,
which made the same change for core/cortex-m/vecttable.c.
The vecttable section was attempting to add the "a" flag, which
indicates the section is allocatable:
https://sourceware.org/binutils/docs/as/Section.html.
Comparing the "text.vecttable" ELF section headers for gcc before and
after this change, in both cases the ALLOC flag is set and there are no
other difference in flags:
arm-none-eabi-objdump -h \
build/discovery-stm32f072/RO/core/cortex-m0/vecttable.o
Sections:
Idx Name Size VMA LMA File off Algn
...
4 .text.vecttable 000000c0 00000000 00000000 0000003c 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
...
However, if we examine the clang section headers before this change we
see that before the change the section name is .text.vecttable,"a",
rather than .text.vecttable:
arm-none-eabi-objdump -h \
build/discovery-stm32f072/RO/core/cortex-m0/vecttable.o
Sections:
Idx Name Size VMA LMA File off Algn
...
3 .text.vecttable,"a" @ 000000c0 00000000 00000000 00000044 2**2
CONTENTS, ALLOC, LOAD, RELOC, DATA
...
After the change, the section is correctly named .text.vecttable:
Sections:
Idx Name Size VMA LMA File off Algn
...
3 .text.vecttable 000000c0 00000000 00000000 00000044 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
...
We also see that the ALLOC flag is correctly set.
BRANCH=none
BUG=b:172020503
TEST=./util/compare_build.sh -b all -j 120
=> MATCH
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I8d84f44266fe3bfe3a942401d9fdbe7760c6af53
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3253650
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | core/cortex-m0/vecttable.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/cortex-m0/vecttable.c b/core/cortex-m0/vecttable.c index de667749ad..5c69f6d6c8 100644 --- a/core/cortex-m0/vecttable.c +++ b/core/cortex-m0/vecttable.c @@ -77,7 +77,11 @@ extern void reset(void); #pragma clang diagnostic ignored "-Winitializer-overrides" #endif /* __clang__ */ -#define table(x) func vectors[] __attribute__((section(".text.vecttable,\"a\" @"))) = { x[IRQ_UNUSED_OFFSET] = null }; +#define table(x) \ + const func vectors[] __attribute__((section(".text.vecttable"))) = { \ + x \ + [IRQ_UNUSED_OFFSET] = null \ + } #define vec(name) name ## _handler, #define irq(num) [num < CONFIG_IRQ_COUNT ? num + IRQ_OFFSET : IRQ_UNUSED_OFFSET] = vec(irq_ ## num) @@ -135,7 +139,7 @@ table( irq(29) irq(30) irq(31) -) +); #if PASS == 2 #ifdef __clang__ |