[PATCH] D34345: [LLD][ELF] Reset any accumulated state before calculating addresses
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 4 09:42:05 PDT 2017
Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
> +// Reset the members associated with address assigment to their initial values
> +// this permits addressAssignment to be run again.
> +void LinkerScript::resetAddressState() {
> + LMAOffset = 0;
> + CurOutSec = nullptr;
> + CurMemRegion = nullptr;
> + ThreadBssOffset = 0;
> + for (auto &MRI : Opt.MemoryRegions) {
> + MemoryRegion &MR = MRI.second;
> + MR.Offset = MR.Origin;
> + }
> +}
These are also not used after address assignment, right?
I am afraid we might miss which variables have to be here. How about
extracting those variables from LinkerScrip.h to a AddressState
class. That way assignAddresses would look like
void LinkerScript::assignAddresses(std::vector<PhdrEntry> &Phdrs) {
AddressState State; ... }
And we know to only put stuff in LinkerScript if it has to survive after
assignAddresses.
Cheers,
Rafael
More information about the llvm-commits
mailing list