Skip to content

Commit 8f4d1e0

Browse files
committed
teach aot emitter/loader about .srodata and .srodata.cst* sections
LLVM 19 and later started to use srodata sections for RISCV. cf. llvm/llvm-project#82214 an alternative is to disable small data sections. but i feel this commit is more consisitent as we are already dealing with sdata sections.
1 parent 0325103 commit 8f4d1e0

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

core/iwasm/aot/aot_loader.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,8 +3191,11 @@ do_text_relocation(AOTModule *module, AOTRelocationGroup *group,
31913191
else if (!strcmp(symbol, ".data") || !strcmp(symbol, ".sdata")
31923192
|| !strcmp(symbol, ".rdata")
31933193
|| !strcmp(symbol, ".rodata")
3194+
|| !strcmp(symbol, ".srodata")
31943195
/* ".rodata.cst4/8/16/.." */
31953196
|| !strncmp(symbol, ".rodata.cst", strlen(".rodata.cst"))
3197+
/* ".srodata.cst4/8/16/.." */
3198+
|| !strncmp(symbol, ".srodata.cst", strlen(".srodata.cst"))
31963199
/* ".rodata.strn.m" */
31973200
|| !strncmp(symbol, ".rodata.str", strlen(".rodata.str"))
31983201
|| !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)