aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAyrton Munoz <ayrton@google.com>2022-12-07 22:54:39 -0500
committerAyrton Munoz <ayrton@google.com>2022-12-07 22:54:39 -0500
commit4cc94cdd94416da0e7d5f0634d9b157f682c1df8 (patch)
treedb9c0668fab57cc5c097bc049ff931b58f703eed /include
parent8da7b880a6c394dfdaf74c702d44c71f07cd629a (diff)
downloadcommon-4cc94cdd94416da0e7d5f0634d9b157f682c1df8.tar.gz
include/shared: Make INCBIN sections allocatable
When the .incbin assembler directive doesn't recognize a section by its name, it creates a new section without any flags. This means that it creates sections that are not allocatable so the sections don't end up in the final executables which leads to linker errors if something references the embedded binary. This commit makes all sections created by INCBIN allocatable so the linker will place them in the executables. Bug: 231151995 Change-Id: Iac88cb0c6581167209b04ba4b1640887f8eef47b
Diffstat (limited to 'include')
-rw-r--r--include/shared/lk/compiler.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/shared/lk/compiler.h b/include/shared/lk/compiler.h
index ff64a316..f3bcfc83 100644
--- a/include/shared/lk/compiler.h
+++ b/include/shared/lk/compiler.h
@@ -55,14 +55,14 @@
#define INCBIN(symname, sizename, filename, section) \
INCBIN_ALIGNED(symname, sizename, filename, section, 4)
-#define INCBIN_ALIGNED(symname, sizename, filename, section, align) \
- __asm__ (".section " section "; .balign " #align "; .globl "#symname); \
- __asm__ (""#symname ":\n.incbin \"" filename "\""); \
- __asm__ (".balign 1; "#symname "_end:"); \
- __asm__ (".balign " #align "; .globl "#sizename); \
- __asm__ (""#sizename ": .long "#symname "_end - "#symname); \
- __asm__ (".previous"); \
- extern unsigned char symname[]; \
+#define INCBIN_ALIGNED(symname, sizename, filename, section, align) \
+ __asm__ (".section " section ", \"a\"; .balign " #align "; .globl "#symname); \
+ __asm__ (""#symname ":\n.incbin \"" filename "\""); \
+ __asm__ (".balign 1; "#symname "_end:"); \
+ __asm__ (".balign " #align "; .globl "#sizename); \
+ __asm__ (""#sizename ": .long "#symname "_end - "#symname); \
+ __asm__ (".previous"); \
+ extern unsigned char symname[]; \
extern unsigned int sizename
#define INCFILE(symname, sizename, filename) INCBIN(symname, sizename, filename, ".rodata")