summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-17 10:22:44 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-17 10:22:44 +0200
commite8db30aa9a321594c22cdb25086654c89eb1bc3c (patch)
treee091282e3571d3813c68c403587220966f29ec18 /dev/LibCompiler/src
parent959a9d5873c6099cf1ae565b13b01f1489fe41e4 (diff)
feat(ld64): Improve codebase, removed redundant variable ae_header.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/src')
-rw-r--r--dev/LibCompiler/src/DynamicLinkerPEF.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/dev/LibCompiler/src/DynamicLinkerPEF.cc b/dev/LibCompiler/src/DynamicLinkerPEF.cc
index 9e3be82..db60c14 100644
--- a/dev/LibCompiler/src/DynamicLinkerPEF.cc
+++ b/dev/LibCompiler/src/DynamicLinkerPEF.cc
@@ -263,11 +263,9 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF) {
reader_protocol.FP = std::ifstream(objectFile, std::ifstream::binary);
reader_protocol.FP >> hdr;
- auto ae_header = hdr;
-
- if (ae_header.fMagic[0] == kAEMag0 && ae_header.fMagic[1] == kAEMag1 &&
- ae_header.fSize == sizeof(LibCompiler::AEHeader)) {
- if (ae_header.fArch != kArch) {
+ if (hdr.fMagic[0] == kAEMag0 && hdr.fMagic[1] == kAEMag1 &&
+ hdr.fSize == sizeof(LibCompiler::AEHeader)) {
+ if (hdr.fArch != kArch) {
if (kVerbose) kOutCon << "Info: is this a FAT binary? : ";
if (!kFatBinaryEnable) {
@@ -287,8 +285,8 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF) {
}
// append arch type to archs varaible.
- archs |= ae_header.fArch;
- std::size_t cnt = ae_header.fCount;
+ archs |= hdr.fArch;
+ std::size_t cnt = hdr.fCount;
if (kVerbose) kOutCon << "Object header found, record count: " << cnt << "\n";
@@ -337,9 +335,9 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF) {
command_header.Offset = offset_of_obj;
command_header.Kind = ae_records[ae_record_index].fKind;
command_header.Size = ae_records[ae_record_index].fSize;
- command_header.Cpu = ae_header.fArch;
+ command_header.Cpu = hdr.fArch;
command_header.VMAddress = org; /// TODO:
- command_header.SubCpu = ae_header.fSubArch;
+ command_header.SubCpu = hdr.fSubArch;
org += command_header.Size;
@@ -356,12 +354,12 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF) {
raw_ae_records = nullptr;
std::vector<char> bytes;
- bytes.resize(ae_header.fCodeSize);
+ bytes.resize(hdr.fCodeSize);
- reader_protocol.FP.seekg(std::streamsize(ae_header.fStartCode));
- reader_protocol.FP.read(bytes.data(), std::streamsize(ae_header.fCodeSize));
+ reader_protocol.FP.seekg(std::streamsize(hdr.fStartCode));
+ reader_protocol.FP.read(bytes.data(), std::streamsize(hdr.fCodeSize));
- kObjectBytes.push_back({.mBlob = bytes, .mOffset = ae_header.fStartCode});
+ kObjectBytes.push_back({.mBlob = bytes, .mOffset = hdr.fStartCode});
// Blob was written, close fp.