Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit fd97941

Browse files
committed
Support glibc compiled static ELF
Now emulator load every segments from binary except NULL address segments and `.bss`
1 parent 160ab85 commit fd97941

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

emu-rv32i.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,9 @@ int main(int argc, char** argv)
20802080
scn = NULL;
20812081
while ((scn = elf_nextscn(elf, scn)) != NULL) {
20822082
gelf_getshdr(scn, &shdr);
2083-
if (shdr.sh_type == SHT_PROGBITS) {
2083+
2084+
/* filter NULL address segments and .bss */
2085+
if (shdr.sh_addr && shdr.sh_type != SHT_NOBITS) {
20842086
Elf_Data *data = elf_getdata(scn, NULL);
20852087
if (shdr.sh_addr >= ram_start) {
20862088
for (size_t i = 0; i < shdr.sh_size; i++) {

0 commit comments

Comments
 (0)