Closed antis81 closed 1 year ago
Interesting… removing line symbol_table:161 kind of improves situation and detects the error. However the testlabel
value still changes (4 -> 6). Plus… this breaks the bcc target in our (new) section_move
test (5 vs 255).
Noteworthy that the undefined
list becomes only(!) relevant together with accessed
context. Maybe we should rename "final" to "has_value" or something…? This is how I at least understand it… :slightly_smiling_face:
Wait a second… Can't we rather check on the section (label?) explicitly in this case when a section is "yet to be defined"? For the section_move
test this relates to section.util.start
and/or section.main.end
(both equal in this case). In pseudo code:
SymbolTable::set(std::string s) {
// … handle other preconditions on the symbol …
// insert symbol into "syms" set
auto& sym = syms[s];
// Symbol gets a value at this point
sym.value = "some value"; // always assigning the value may help with debugging>
// If section (label) is not in a final state, every address label inside also cannot be final (in this current PASS)
auto const& current_section = get_current_section(); // How to reteive?
sym.final = current_section.final; // maybe the "final" state should be completely moved to section…??
}
Sounds not too bad don't you think?
Well, the symbol table does not know anything about the assembler and its workings so that wouldn't fly.
The main problem is that I have not clearly defined how things should work with undefined & redefined symbols.
One issue is what the type should be of an undefined symbol? Right now it always becomes a number.
Another problem is how to support dot-symbols.
Was there a specific use case/example you where trying to solve?
Was there a specific use case/example you where trying to solve?
Yeah now it's becoming history… :slightly_smiling_face: Originally bass from master (d2bb375) fails against my project code with "max number passes"… Removing the mentioned "undefined.insert…" line worked "good enough".
So now the tests work. You are not allowed to redefine symbols normally. Final should be the default really, but this was an easier fix for now.
Boils down to
is_redefinable
returning true when it should not…Debugging Info
Running bass with debugging options shows the issue (surprisingly already in PASS 1):
Outputs
(where 4 and 6 are the correct byte offsets to
nop
respectivelyrts
)Running with more passes results in 6 and 4 being exchanged endlessly…