The [] operator from the std::map class adds an element if the key is not present in the map, which is errorprone (I had issues with this when trying to add ld support to recomp), so I changed every use I could find to an .at, which doesn't add values if it doesn't find the key inside the map and does boundary checking, so problems can be catched earlier.
The only real change I made was in inspect_data_function_pointers.
This function was relying on the "add if not present" functionality from the [] operator, so I changed it so the function is being added explicitly.
Removed the label_addresses.insert(addr); call from that function, since that set is meant only for jumptable labels and branch targets. I checked for any possible changes in the generated code, and seems like the only change was recomp stopped emitting some unused labels at the start of some functions and nothing else
The
[]
operator from thestd::map
class adds an element if the key is not present in the map, which is errorprone (I had issues with this when trying to addld
support to recomp), so I changed every use I could find to an.at
, which doesn't add values if it doesn't find the key inside the map and does boundary checking, so problems can be catched earlier.The only real change I made was in
inspect_data_function_pointers
.[]
operator, so I changed it so the function is being added explicitly.label_addresses.insert(addr);
call from that function, since that set is meant only for jumptable labels and branch targets. I checked for any possible changes in the generated code, and seems like the only change was recomp stopped emitting some unused labels at the start of some functions and nothing else