[PATCH] D40029: [ELF] Only add contiguous isRelro sections to PT_GNU_RELRO PHDR
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 21 09:41:55 PST 2017
I think I am fine with the overall direction of this change.
My main request is to split the patch in 2 or even better 3:
* Give an error if relro is not contiguous.
* Relax handling of empty sections.
* Name change when linker scripts are used.
> + bool InRelroPhdr = false;
> + bool IsRelroFinished = false;
> + for (OutputSection *Sec : OutputSections) {
> + if (!needsPtLoad(Sec))
> + continue;
> + if (isRelroSection(Sec)) {
> + InRelroPhdr = true;
> + if (!IsRelroFinished)
> + RelRo->add(Sec);
> + else if (Sec->Size)
> + error("section: " + Sec->Name + " is not contiguous with other relro" +
> + " sections");
> + } else if (InRelroPhdr && Sec->Size) {
> + InRelroPhdr = false;
> + IsRelroFinished = true;
> + }
> + }
With this an empty relro section can still start the PT_GNU_RELRO. Is
that intentional?
Cheers,
Rafael
More information about the llvm-commits
mailing list