summaryrefslogtreecommitdiff
path: root/core/cortex-m0
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-10-15 23:08:30 +0000
committerCommit Bot <commit-bot@chromium.org>2021-11-17 18:24:18 +0000
commit5374c39953e955b25f7bf4bdc0d240edc469a4f8 (patch)
tree75ef936c0789bc571e4546106d7d8c8b9d7578ff /core/cortex-m0
parentb2beae016c56e430364ca1030e313c1f449d68ed (diff)
downloadchrome-ec-5374c39953e955b25f7bf4bdc0d240edc469a4f8.tar.gz
core/cortex-m0: Include .bss and .data subsections
When compiling with clang (linking with lld), there are many .data and .bss subsections that are not being included in .data and .bss. For example, .data.board_get_version.ver and .bss.usart3_usb_state. The following shows the complete section output when compiling with clang before this change: arm-none-eabi-objdump -h build/servo_v4/RO/ec.RO.elf build/servo_v4/RO/ec.RO.elf: file format elf32-littlearm Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000c39c 08000000 08000000 00010000 2**3 CONTENTS, ALLOC, LOAD, CODE 1 .rodata 00002b44 0800c39c 0800c39c 0001c39c 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .data.board_get_version.ver 00000004 20000000 20000000 00020000 2**2 CONTENTS, ALLOC, LOAD, DATA 3 .data..compoundliteral.158 0000003a 20000004 20000004 00020004 2**1 CONTENTS, ALLOC, LOAD, DATA 4 .data.iface_next 00000001 2000003e 2000003e 0002003e 2**0 CONTENTS, ALLOC, LOAD, DATA 5 .data.last_tx_ok 00000004 20000040 20000040 00020040 2**2 CONTENTS, ALLOC, LOAD, DATA 6 .data.print_reg.rname 00000003 20000044 20000044 00020044 2**0 CONTENTS, ALLOC, LOAD, DATA 7 .data..L_MergedGlobals 00000068 20000048 20000048 00020048 2**3 CONTENTS, ALLOC, LOAD, DATA 8 .vtable 000000c0 200000b0 200000b0 000200b0 2**0 ALLOC 9 .bss 00000480 20000170 20000170 000200b0 2**0 ALLOC 10 .data 00000000 200005f0 0800eee0 000205f0 2**0 CONTENTS, ALLOC, LOAD, DATA 11 .usb_ram 00000278 40006000 40006000 000205f0 2**3 ALLOC 12 .bss.usart3_usb_state 00000008 200005f0 0800eee0 000205f0 2**2 ALLOC 13 .bss.usart4_usb_state 00000008 200005f8 0800eee8 000205f0 2**2 ALLOC 14 .bss..compoundliteral.64 00000008 20000600 0800eef0 000205f0 2**2 ALLOC 15 .bss..compoundliteral.66 00000040 20000608 0800eef8 000205f0 2**0 ALLOC ... 61 .bss..L_MergedGlobals.845 00000070 20003550 08011e40 000205f0 2**2 ALLOC 62 .debug_info 00014398 00000000 00000000 000205f0 2**0 CONTENTS, READONLY, DEBUGGING, OCTETS ... When compiling with gcc (and clang with this fix), we see that there is only a single .data and .bss section (all of the subsections have been included in .data and .bss): build/servo_v4/RO/ec.RO.elf: file format elf32-littlearm Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000c390 08000000 08000000 00010000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .rodata 00002a50 0800c390 0800c390 0001c390 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 2 .vtable 000000c0 20000000 20000000 00030000 2**0 ALLOC 3 .bss 00003408 200000c0 200000c0 00030000 2**3 ALLOC 4 .data 000000b8 200034c8 0800ede0 000234c8 2**3 CONTENTS, ALLOC, LOAD, DATA ... The output for all boards is exactly the same before and after this change when compiling with gcc. BRANCH=none BUG=b:172020503 TEST=CC=clang make BOARD=servo_v4 TEST=./util/compare_board.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id8ae9689c739779fe048c3577e105280c3c6869b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229480 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'core/cortex-m0')
-rw-r--r--core/cortex-m0/ec.lds.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index a04b92f5ff..ce67760cf2 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -263,7 +263,7 @@ SECTIONS
. = ALIGN(8);
*(.bss.system_stack)
/* Rest of .bss takes care of its own alignment */
- *(.bss)
+ *(.bss*)
/*
* Reserve space for deferred function firing times.
@@ -284,7 +284,7 @@ SECTIONS
. = ALIGN(4);
__data_start = .;
*(.data.tasks)
- *(.data)
+ *(.data*)
. = ALIGN(4);
*(.iram.text)
. = ALIGN(4);