Merge changes from topic "fix-lto-build" into integration

* changes:
  fix(build): don't generate build-id
  fix(build): add forgotten BL_LDFLAGS to lto command line
  feat(build): check that .text section starts at page boundary
This commit is contained in:
André Przywara 2023-11-30 16:36:40 +01:00 committed by TrustedFirmware Code Review
commit 8ddb02d5af
9 changed files with 45 additions and 1 deletions

View file

@ -361,6 +361,7 @@ else ifneq ($(findstring gcc,$(notdir $(LD))),)
TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants TF_LDFLAGS += -Wl,-z,common-page-size=4096 #Configure page size constants
TF_LDFLAGS += -Wl,-z,max-page-size=4096 TF_LDFLAGS += -Wl,-z,max-page-size=4096
TF_LDFLAGS += -Wl,--build-id=none
ifeq ($(ENABLE_LTO),1) ifeq ($(ENABLE_LTO),1)
ifeq (${ARCH},aarch64) ifeq (${ARCH},aarch64)
@ -388,6 +389,7 @@ else
TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants
TF_LDFLAGS += -z max-page-size=4096 TF_LDFLAGS += -z max-page-size=4096
TF_LDFLAGS += --build-id=none
# ld.lld doesn't recognize the errata flags, # ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case. # therefore don't add those in that case.

View file

@ -36,6 +36,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
*bl1_entrypoint.o(.text*) *bl1_entrypoint.o(.text*)
@ -80,6 +83,9 @@ SECTIONS {
} >ROM } >ROM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*bl1_entrypoint.o(.text*) *bl1_entrypoint.o(.text*)

View file

@ -25,6 +25,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
#if ENABLE_RME #if ENABLE_RME
@ -65,6 +68,9 @@ SECTIONS {
} >RAM } >RAM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*bl2_entrypoint.o(.text*) *bl2_entrypoint.o(.text*)

View file

@ -55,6 +55,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
__TEXT_RESIDENT_START__ = .; __TEXT_RESIDENT_START__ = .;
@ -89,6 +92,9 @@ SECTIONS {
"Resident part of BL2 has exceeded its limit.") "Resident part of BL2 has exceeded its limit.")
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
__TEXT_RESIDENT_START__ = .; __TEXT_RESIDENT_START__ = .;

View file

@ -27,6 +27,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
*bl2u_entrypoint.o(.text*) *bl2u_entrypoint.o(.text*)
@ -60,6 +63,9 @@ SECTIONS {
} >RAM } >RAM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*bl2u_entrypoint.o(.text*) *bl2u_entrypoint.o(.text*)

View file

@ -37,6 +37,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
*bl31_entrypoint.o(.text*) *bl31_entrypoint.o(.text*)
@ -71,6 +74,9 @@ SECTIONS {
} >RAM } >RAM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*bl31_entrypoint.o(.text*) *bl31_entrypoint.o(.text*)

View file

@ -29,6 +29,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
*entrypoint.o(.text*) *entrypoint.o(.text*)
@ -67,6 +70,9 @@ SECTIONS {
} >RAM } >RAM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*entrypoint.o(.text*) *entrypoint.o(.text*)

View file

@ -25,6 +25,9 @@ SECTIONS {
#if SEPARATE_CODE_AND_RODATA #if SEPARATE_CODE_AND_RODATA
.text . : { .text . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".text address is not aligned on a page boundary.");
__TEXT_START__ = .; __TEXT_START__ = .;
*tsp_entrypoint.o(.text*) *tsp_entrypoint.o(.text*)
@ -51,6 +54,9 @@ SECTIONS {
} >RAM } >RAM
#else /* SEPARATE_CODE_AND_RODATA */ #else /* SEPARATE_CODE_AND_RODATA */
.ro . : { .ro . : {
ASSERT(. == ALIGN(PAGE_SIZE),
".ro address is not aligned on a page boundary.");
__RO_START__ = .; __RO_START__ = .;
*tsp_entrypoint.o(.text*) *tsp_entrypoint.o(.text*)

View file

@ -573,7 +573,7 @@ ifneq ($(findstring armlink,$(notdir $(LD))),)
$(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) \ $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) \
$(BUILD_DIR)/build_message.o $(OBJS) $(BUILD_DIR)/build_message.o $(OBJS)
else ifneq ($(findstring gcc,$(notdir $(LD))),) else ifneq ($(findstring gcc,$(notdir $(LD))),)
$$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) -Wl,-Map=$(MAPFILE) \ $$(Q)$$(LD) -o $$@ $$(TF_LDFLAGS) $$(LDFLAGS) $(BL_LDFLAGS) -Wl,-Map=$(MAPFILE) \
$(addprefix -Wl$(comma)--script$(comma),$(LINKER_SCRIPTS)) -Wl,--script,$(DEFAULT_LINKER_SCRIPT) \ $(addprefix -Wl$(comma)--script$(comma),$(LINKER_SCRIPTS)) -Wl,--script,$(DEFAULT_LINKER_SCRIPT) \
$(BUILD_DIR)/build_message.o \ $(BUILD_DIR)/build_message.o \
$(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS) $(OBJS) $(LDPATHS) $(LIBWRAPPER) $(LDLIBS) $(BL_LIBS)