mirror of
https://github.com/ksherlock/merlin-utils.git
synced 2025-01-04 18:32:12 +00:00
fix segment numbers
This commit is contained in:
parent
e7e77f4b5c
commit
d4ba40ca34
6
link.cpp
6
link.cpp
@ -259,7 +259,7 @@ static void process_labels(byte_view &data, cookie &cookie) {
|
|||||||
}
|
}
|
||||||
e->defined = true;
|
e->defined = true;
|
||||||
e->file = cookie.file;
|
e->file = cookie.file;
|
||||||
e->segment = segments.size();
|
e->segment = segments.size() - 1; /* 1-based */
|
||||||
if (flag & SYMBOL_ABSOLUTE) {
|
if (flag & SYMBOL_ABSOLUTE) {
|
||||||
e->absolute = true;
|
e->absolute = true;
|
||||||
e->value = value;
|
e->value = value;
|
||||||
@ -457,6 +457,7 @@ static void resolve(void) {
|
|||||||
auto &seg = segments[seg_num];
|
auto &seg = segments[seg_num];
|
||||||
auto &pending = relocations[seg_num];
|
auto &pending = relocations[seg_num];
|
||||||
|
|
||||||
|
seg.segnum = seg_num + 1;
|
||||||
|
|
||||||
for (auto &r : pending) {
|
for (auto &r : pending) {
|
||||||
assert(r.id < symbol_map.size());
|
assert(r.id < symbol_map.size());
|
||||||
@ -482,6 +483,7 @@ static void resolve(void) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* e.segment is 0-based */
|
||||||
if (e.segment == seg_num) {
|
if (e.segment == seg_num) {
|
||||||
r.value += e.value;
|
r.value += e.value;
|
||||||
seg.relocs.emplace_back(r);
|
seg.relocs.emplace_back(r);
|
||||||
@ -492,7 +494,7 @@ static void resolve(void) {
|
|||||||
inter.size = r.size;
|
inter.size = r.size;
|
||||||
inter.shift = r.shift;
|
inter.shift = r.shift;
|
||||||
inter.offset = r.offset;
|
inter.offset = r.offset;
|
||||||
inter.segment = e.segment;
|
inter.segment = e.segment + 1; /* 1-based */
|
||||||
inter.segment_offset = r.value + e.value;
|
inter.segment_offset = r.value + e.value;
|
||||||
|
|
||||||
seg.intersegs.emplace_back(inter);
|
seg.intersegs.emplace_back(inter);
|
||||||
|
Loading…
Reference in New Issue
Block a user