mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2025-02-06 17:30:17 +00:00
remove dead code, fix expression location adjustment.
This commit is contained in:
parent
7e09ecd5f2
commit
6aa7418561
14
link.cpp
14
link.cpp
@ -830,15 +830,6 @@ void to_omf(const expression &e, omf::segment &seg) {
|
|||||||
r.offset = e.offset;
|
r.offset = e.offset;
|
||||||
r.value = value;
|
r.value = value;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// handle later.
|
|
||||||
// if generating a super, store inline.
|
|
||||||
if (!flags._C && r.can_compress()) {
|
|
||||||
for (int i = 0; i < e.size; ++i, value >>= 8)
|
|
||||||
seg.data[e.offset + i] = value & 0xff;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
seg.relocs.emplace_back(r);
|
seg.relocs.emplace_back(r);
|
||||||
} else {
|
} else {
|
||||||
omf::interseg r;
|
omf::interseg r;
|
||||||
@ -1050,8 +1041,13 @@ void build_omf_segments() {
|
|||||||
|
|
||||||
// now adjust all the expressions, simplify, and convert to reloc records.
|
// now adjust all the expressions, simplify, and convert to reloc records.
|
||||||
for (auto &s :sections) {
|
for (auto &s :sections) {
|
||||||
|
|
||||||
|
auto &x = remap[s.number];
|
||||||
|
|
||||||
for (auto &e : s.expressions) {
|
for (auto &e : s.expressions) {
|
||||||
|
|
||||||
|
e.offset += x.second;
|
||||||
|
|
||||||
for (auto &t : e.stack) {
|
for (auto &t : e.stack) {
|
||||||
if (t.tag == OP_LOC) {
|
if (t.tag == OP_LOC) {
|
||||||
const auto &x = remap[t.section];
|
const auto &x = remap[t.section];
|
||||||
|
42
omf.cpp
42
omf.cpp
@ -412,48 +412,6 @@ void save_omf(const std::string &path, std::vector<omf::segment> &segments, bool
|
|||||||
uint32_t reloc_size = 0;
|
uint32_t reloc_size = 0;
|
||||||
|
|
||||||
reloc_size = add_relocs(data, data_offset, s, compress);
|
reloc_size = add_relocs(data, data_offset, s, compress);
|
||||||
#if 0
|
|
||||||
// should interseg/reloc records be sorted?
|
|
||||||
// todo -- compress into super records.
|
|
||||||
for (const auto &r : s.relocs) {
|
|
||||||
if (r.can_compress()) {
|
|
||||||
push(data, (uint8_t)0xf5);
|
|
||||||
push(data, (uint8_t)r.size);
|
|
||||||
push(data, (uint8_t)r.shift);
|
|
||||||
push(data, (uint16_t)r.offset);
|
|
||||||
push(data, (uint16_t)r.value);
|
|
||||||
reloc_size += 7;
|
|
||||||
} else {
|
|
||||||
push(data, (uint8_t)0xe5);
|
|
||||||
push(data, (uint8_t)r.size);
|
|
||||||
push(data, (uint8_t)r.shift);
|
|
||||||
push(data, (uint32_t)r.offset);
|
|
||||||
push(data, (uint32_t)r.value);
|
|
||||||
reloc_size += 11;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &r : s.intersegs) {
|
|
||||||
if (r.can_compress()) {
|
|
||||||
push(data, (uint8_t)0xf6);
|
|
||||||
push(data, (uint8_t)r.size);
|
|
||||||
push(data, (uint8_t)r.shift);
|
|
||||||
push(data, (uint16_t)r.offset);
|
|
||||||
push(data, (uint8_t)r.segment);
|
|
||||||
push(data, (uint16_t)r.segment_offset);
|
|
||||||
reloc_size += 8;
|
|
||||||
} else {
|
|
||||||
push(data, (uint8_t)0xe3);
|
|
||||||
push(data, (uint8_t)r.size);
|
|
||||||
push(data, (uint8_t)r.shift);
|
|
||||||
push(data, (uint32_t)r.offset);
|
|
||||||
push(data, (uint16_t)r.file);
|
|
||||||
push(data, (uint16_t)r.segment);
|
|
||||||
push(data, (uint32_t)r.segment_offset);
|
|
||||||
reloc_size += 15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// end-of-record
|
// end-of-record
|
||||||
push(data, (uint8_t)omf::END);
|
push(data, (uint8_t)omf::END);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user