Fix mpy-cross and lto builds (again)

This commit is contained in:
Jeff Epler 2023-10-30 14:46:10 +01:00
parent 8724b43e15
commit 7fe886aeae
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 2 additions and 3 deletions

View File

@ -34,7 +34,6 @@
// Map MicroPython's error messages to our translations.
#if !defined(MICROPY_ENABLE_DYNRUNTIME) || !MICROPY_ENABLE_DYNRUNTIME
#include "supervisor/shared/translate/compressed_string.h"
#define MP_COMPRESSED_ROM_TEXT(x) MP_ERROR_TEXT(x)
// MP_ERROR_TEXT() is a giant function with many strcmp calls. The assumption is
// that the build process will optimize this away and replace it with the
@ -48,7 +47,7 @@
#else
// In link time optimized (LTO) builds, we can compile this once into a .o and
// at link time the calls will be optimized.
mp_rom_error_text_t MP_ERROR_TEXT(const char *c);
mp_rom_error_text_t MP_COMPRESSED_ROM_TEXT(const char *c);
#endif
#else

View File

@ -50,7 +50,7 @@ __attribute__((always_inline))
#endif
// Prevent instrumenting this because that disables the inlining we rely of for code size
// optimization.
__attribute__((no_instrument_function)) mp_rom_error_text_t translate(const char *original) {
__attribute__((no_instrument_function)) mp_rom_error_text_t MP_COMPRESSED_ROM_TEXT(const char *original) {
#ifndef NO_QSTR
#define QDEF(id, hash, len, str)
#define TRANSLATION(english_id, number) if (strcmp(original, english_id) == 0) { return (mp_rom_error_text_t)&translation##number; } else