Disable LTO for external apps (#1886)

* Disable lto for external apps only

* Modified "shared external code" checks
This commit is contained in:
Mark Thompson 2024-02-13 10:11:54 -06:00 committed by GitHub
parent 918ec0574f
commit 2f48fc2ef9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 6 deletions

View File

@ -52,7 +52,7 @@ set(USE_LINK_GC yes)
# Linker extra options here.
set(USE_LDOPT)
# Enable this if you want link time optimizations (LTO)
# Enable this if you want link time optimizations (LTO) - this flag affects chibios only
set(USE_LTO no)
# If enabled, this option allows to compile the application in THUMB mode.
@ -293,7 +293,7 @@ set(CPPSRC
# apps/ui_jammer.cpp
# apps/ui_keyfob.cpp
# apps/ui_lcr.cpp
apps/ui_level.cpp
apps/ui_level.cpp
apps/ui_looking_glass_app.cpp
apps/ui_mictx.cpp
apps/ui_modemsetup.cpp
@ -304,7 +304,7 @@ set(CPPSRC
apps/ui_pocsag_tx.cpp
apps/ui_rds.cpp
apps/ui_recon_settings.cpp
apps/ui_recon.cpp
apps/ui_recon.cpp
apps/ui_remote.cpp
apps/ui_scanner.cpp
apps/ui_sd_over_usb.cpp
@ -492,6 +492,7 @@ add_custom_command(
)
add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC})
set_source_files_properties(${EXTCPPSRC} PROPERTIES COMPILE_FLAGS -fno-lto)
set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_DEPENDS ${LDSCRIPT})
add_definitions(${DEFS})
include_directories(. ${INCDIR})

View File

@ -49,5 +49,5 @@ for i in range(0, len(image), 4):
snippet = image[i:i+4]
val = int.from_bytes(snippet, byteorder='little')
offset = val & 0xFFFF
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size) and ((val & 0x3)==0):
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size):
print ("External code address", hex(val),"at offset", hex(i),"in", sys.argv[1])

View File

@ -76,7 +76,7 @@ def patch_image(path, image_data, search_address, replace_address):
external_application_image += new_snippet
else:
external_application_image += snippet
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size) and ((val & 0x3)==0):
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size):
print ("WARNING: External code address", hex(val), "at offset", hex(x*4), "in", path)
return external_application_image

View File

@ -91,7 +91,7 @@ for i in range(0, len(spi_image), 4):
snippet = spi_image[i:i+4]
val = int.from_bytes(snippet, byteorder='little')
checksum += val
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size) and ((val & 0x3)==0):
if (val >= external_apps_address_start) and (val < external_apps_address_end) and ((val & 0xFFFF) < maximum_application_size):
print ("WARNING: External code address", hex(val), "at offset", hex(i), "in", sys.argv[3])
final_checksum = 0