[bazel] Move _mask_rom_interrupt_vector_c to .vectors to eliminate padding #12451
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had some time to look more into the size difference between the binaries built using meson vs bazel, specifically why
mask_rom_exception_handler()
is placed at the start of the.crt
section when using bazel. This introduces extra padding since_mask_rom_interrupt_vector_c
is aligned to 256 bytes.I think, the reason why we don't have this issue in meson is because
mask_rom_start.S
appears beforemask_rom.c
. Reordering them in thesrcs
ofopentian_rom_binary()
insw/device/silicon_creator/mask_rom/BUILD
fixes the issue but would be very fragile (also not allowed by the buildifier).I was thinking about updating the linker file and
mask_rom.h
to put the functions defined in c after asm definitions but realized that we can actually place_mask_rom_interrupt_vector_c
into.vectors
instead of.crt
without any overhead since the c interrupt vector is aligned to 256 bytes as well, i.e. the comment removed in this PR doesn't seem to be accurate.mask_rom_fpga_cw310.elf.s
: before, afterThis PR also reduces the size of
mask_rom_fpga_cw310.bin
from 31832 bytes to 31640 bytes (-192 bytes)Related to #12069 (@timothytrippel).
Signed-off-by: Alphan Ulusoy [email protected]