summaryrefslogtreecommitdiffhomepage
path: root/Sources
diff options
context:
space:
mode:
authorAmlal El Mahrouss <113760121+Amlal-ElMahrouss@users.noreply.github.com>2024-03-29 21:38:50 +0100
committerAmlal El Mahrouss <113760121+Amlal-ElMahrouss@users.noreply.github.com>2024-03-29 21:39:07 +0100
commit246f2d12bf6a07c739c96f249a2b8e0202f4dc72 (patch)
tree6cb6015e9373269b4882af7e3e5550f0d6508c67 /Sources
parent3451e9187881684ef2a6f99a707ad74f4d4a2e3b (diff)
CodeTools: See below.
- Fix 64x0 assembler stw and ldw instructions and force usage of :UndefinedSymbol: - Linker :boom: changes, update container format and ABIs. Authored by Amlal El Mahrouss. Signed-off-by: Amlal El Mahrouss <113760121+Amlal-ElMahrouss@users.noreply.github.com>
Diffstat (limited to 'Sources')
-rw-r--r--Sources/64asm.cc11
-rw-r--r--Sources/link.cc19
2 files changed, 21 insertions, 9 deletions
diff --git a/Sources/64asm.cc b/Sources/64asm.cc
index c389974..92687ae 100644
--- a/Sources/64asm.cc
+++ b/Sources/64asm.cc
@@ -333,7 +333,7 @@ static bool asm_read_attributes(std::string &line) {
// this is a special case for the start stub.
// we want this so that ld can find it.
- if (name == "__start") {
+ if (name.find("__start") != std::string::npos) {
kCurrentRecord.fKind = CompilerKit::kPefCode;
}
@@ -903,8 +903,15 @@ bool CompilerKit::Encoder64x0::WriteLine(std::string &line,
throw std::runtime_error("label_empty");
}
+ /// don't go any further if:
+ /// load word (ldw) or store word. (stw)
+
+ if (name == "ldw" ||
+ name == "stw")
+ break;
+
auto mld_reloc_str = std::to_string(cpy_jump_label.size());
- mld_reloc_str += kRelocSymbol;
+ mld_reloc_str += kUndefinedSymbol;
mld_reloc_str += cpy_jump_label;
bool ignore_back_slash = false;
diff --git a/Sources/link.cc b/Sources/link.cc
index f80e45f..93982cb 100644
--- a/Sources/link.cc
+++ b/Sources/link.cc
@@ -431,13 +431,13 @@ MPCC_MODULE(HCoreLinker) {
time_t timestamp = time(nullptr);
- std::string timeStampStr = "ContainerDate:";
+ std::string timeStampStr = "Container:BuildEpoch:";
timeStampStr += std::to_string(timestamp);
strcpy(dateHeader.Name, timeStampStr.c_str());
dateHeader.Flags = 0;
- dateHeader.Kind = CompilerKit::kPefData;
+ dateHeader.Kind = CompilerKit::kPefZero;
dateHeader.Offset = outputFc.tellp();
dateHeader.Size = timeStampStr.size();
@@ -449,12 +449,16 @@ MPCC_MODULE(HCoreLinker) {
switch (kArch) {
case CompilerKit::kPefArchAMD64: {
- abi += "HCOR";
+ abi += "MS*T";
+ break;
+ }
+ case CompilerKit::kPefArchPowerPC: {
+ abi += "MHRP";
break;
}
case CompilerKit::kPefArch32000:
case CompilerKit::kPefArch64000: {
- abi += "MPUX";
+ abi += "MHRC";
break;
}
default: {
@@ -483,14 +487,15 @@ MPCC_MODULE(HCoreLinker) {
auto gen = uuids::uuid_random_generator{generator};
uuids::uuid id = gen();
+ auto uuidStr = uuids::to_string(id);
- memcpy(uuidHeader.Name, "UUID_KIND:4:", strlen("UUID_KIND:4:"));
- memcpy(uuidHeader.Name + strlen("UUID_KIND:4:"), id.as_bytes().data(), id.as_bytes().size());
+ memcpy(uuidHeader.Name, "Container:GUID:4:", strlen("Container:GUID:4:"));
+ memcpy(uuidHeader.Name + strlen("Container:GUID:4:"), uuidStr.c_str(), uuidStr.size());
uuidHeader.Size = 16;
uuidHeader.Offset = outputFc.tellp();
uuidHeader.Flags = 0;
- uuidHeader.Kind = 0;
+ uuidHeader.Kind = CompilerKit::kPefZero;
outputFc << uuidHeader;