mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-14 01:29:11 +00:00
delay adding a symbol for the section name.
This commit is contained in:
parent
e9383cfcdc
commit
253a3ccc49
28
link.cpp
28
link.cpp
@ -474,7 +474,10 @@ void one_module(const std::vector<uint8_t> &data,
|
||||
// duplicate label error...
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// add entry for name? or handle via undefined symbol lookup below?
|
||||
handled at end if symbol undeinfed.
|
||||
|
||||
sym.name = s.name;
|
||||
sym.section = virtual_section;
|
||||
@ -488,7 +491,7 @@ void one_module(const std::vector<uint8_t> &data,
|
||||
} else {
|
||||
// duplicate label error...
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
sym.name = "_END_" + s.name;
|
||||
upper_case(sym.name);
|
||||
@ -856,7 +859,27 @@ void generate_end() {
|
||||
*/
|
||||
|
||||
for (const auto &s : sections) {
|
||||
if (!s.end_symbol) continue;
|
||||
|
||||
// if there is an undefined symbol matching the section name, add it.
|
||||
if ((s.flags & SEC_NONAME) == 0) {
|
||||
|
||||
auto iter = symbol_map.find(s.name);
|
||||
if (iter != symbol_map.end()) {
|
||||
|
||||
symbol &sym = symbols[iter->second];
|
||||
if (sym.type == S_UND) {
|
||||
undefined_symbols.erase(s.name);
|
||||
sym.section = s.number;
|
||||
sym.type = S_REL;
|
||||
sym.flags = SF_DEF | SF_GBL;
|
||||
sym.offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (s.end_symbol) {
|
||||
|
||||
symbol &sym = symbols[s.end_symbol];
|
||||
|
||||
sym.section = s.number;
|
||||
@ -864,6 +887,7 @@ void generate_end() {
|
||||
sym.flags = SF_DEF | SF_GBL;
|
||||
sym.offset = s.size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user