Skip to content

Commit 3232bdf

Browse files
authored
teach aot emitter/loader about .srodata and .srodata.cst* sections (#4240)
LLVM 19 and later started to use srodata ("small read only data") sections for RISCV. cf. llvm/llvm-project#82214 this commit makes our aot emitter/loader deal with those sections. an alternative would be to disable small data sections completely by setting the "SmallDataLimit" module attribute to zero. however, i feel this commit is more straightforward and consisitent as we are already dealing with sdata sections.
1 parent 9773390 commit 3232bdf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

core/iwasm/aot/aot_loader.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,10 +3189,12 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
31893189
symbol_addr = module->code;
31903190
}
31913191
else if (!strcmp(symbol, ".data") || !strcmp(symbol, ".sdata")
3192-
|| !strcmp(symbol, ".rdata")
3193-
|| !strcmp(symbol, ".rodata")
3192+
|| !strcmp(symbol, ".rdata") || !strcmp(symbol, ".rodata")
3193+
|| !strcmp(symbol, ".srodata")
31943194
/* ".rodata.cst4/8/16/.." */
31953195
|| !strncmp(symbol, ".rodata.cst", strlen(".rodata.cst"))
3196+
/* ".srodata.cst4/8/16/.." */
3197+
|| !strncmp(symbol, ".srodata.cst", strlen(".srodata.cst"))
31963198
/* ".rodata.strn.m" */
31973199
|| !strncmp(symbol, ".rodata.str", strlen(".rodata.str"))
31983200
|| !strcmp(symbol, AOT_STACK_SIZES_SECTION_NAME)

core/iwasm/compilation/aot_emit_aot_file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,8 +3270,17 @@ is_data_section(AOTObjectData *obj_data, LLVMSectionIteratorRef sec_itr,
32703270

32713271
return (!strcmp(section_name, ".data") || !strcmp(section_name, ".sdata")
32723272
|| !strcmp(section_name, ".rodata")
3273+
#if LLVM_VERSION_MAJOR >= 19
3274+
/* https://github.com/llvm/llvm-project/pull/82214 */
3275+
|| !strcmp(section_name, ".srodata")
3276+
#endif
32733277
/* ".rodata.cst4/8/16/.." */
32743278
|| !strncmp(section_name, ".rodata.cst", strlen(".rodata.cst"))
3279+
#if LLVM_VERSION_MAJOR >= 19
3280+
/* https://github.com/llvm/llvm-project/pull/82214
3281+
* ".srodata.cst4/8/16/.." */
3282+
|| !strncmp(section_name, ".srodata.cst", strlen(".srodata.cst"))
3283+
#endif
32753284
/* ".rodata.strn.m" */
32763285
|| !strncmp(section_name, ".rodata.str", strlen(".rodata.str"))
32773286
|| (!strcmp(section_name, ".rdata")

0 commit comments

Comments
 (0)