From b97a21c2532622a83e9153996e303c3edc2727a8 Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 22 Jan 2025 10:42:19 -0800 Subject: [PATCH] git subrepo pull tools/fado (#2437) subrepo: subdir: "tools/fado" merged: "a45f99b46" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "a45f99b46" git-subrepo: version: "0.4.6" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "110b9eb" --- tools/fado/.gitrepo | 4 ++-- tools/fado/lib/fairy/fairy.c | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/fado/.gitrepo b/tools/fado/.gitrepo index 5fac8601da..c68147bb9b 100644 --- a/tools/fado/.gitrepo +++ b/tools/fado/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:EllipticEllipsis/fado.git branch = master - commit = 7fad57f834a86b6a752292996f99f08771f29df4 - parent = 17d683780d3878159959a87a9c4a2683d8781ef2 + commit = a45f99b46d2f70fb14f4648907f493b28a96a78a + parent = 06904e1ee76828591b42f419a5e4f80106de4615 method = merge cmdver = 0.4.6 diff --git a/tools/fado/lib/fairy/fairy.c b/tools/fado/lib/fairy/fairy.c index 8fc090300c..afecec40e9 100644 --- a/tools/fado/lib/fairy/fairy.c +++ b/tools/fado/lib/fairy/fairy.c @@ -364,10 +364,10 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) { off += 1; case SHT_REL: off += 5; - /* This assumes only one reloc section of each name */ - // TODO: is this a problem? { FairySection relocSection = FAIRY_SECTION_OTHER; + FairyRela* relocs; + size_t relocCount; /* Ignore the first 5/6 chars, which will always be ".rel."/".rela." */ if (strcmp(&shstrtab[currentSection.sh_name + off], "text") == 0) { @@ -381,11 +381,23 @@ void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file) { } FAIRY_DEBUG_PRINTF("Found %s section\n", &shstrtab[currentSection.sh_name]); + relocCount = Fairy_ReadRelocs(&relocs, file, currentSection.sh_type, currentSection.sh_offset, + currentSection.sh_size); + + /* Ignore empty reloc sections */ + if (relocCount == 0) { + free(relocs); + break; + } + + /* This assumes only one non-empty reloc section of each name */ + /* TODO: is this a problem? */ + assert(fileInfo->relocTablesInfo[relocSection].sectionData == NULL); + + fileInfo->relocTablesInfo[relocSection].sectionData = relocs; fileInfo->relocTablesInfo[relocSection].sectionType = SHT_RELA; fileInfo->relocTablesInfo[relocSection].sectionEntrySize = sizeof(FairyRela); - fileInfo->relocTablesInfo[relocSection].sectionEntryCount = - Fairy_ReadRelocs((FairyRela**)&fileInfo->relocTablesInfo[relocSection].sectionData, file, - currentSection.sh_type, currentSection.sh_offset, currentSection.sh_size); + fileInfo->relocTablesInfo[relocSection].sectionEntryCount = relocCount; } break;