Each object file compiled in split stack mode will have an empty
section with a special name: .note.GNU-split-stack
We don't support this in linker now, so patch just adds an error out for that.
Differential D17918
[ELF] - Issue an error if trying to link object that uses splitstacks. grimar on Mar 6 2016, 6:25 AM. Authored by
Details Each object file compiled in split stack mode will have an empty We don't support this in linker now, so patch just adds an error out for that.
Diff Detail Event TimelineComment Actions
This patch is just about producing an error (when linking with -r) if one object Generally I am not sure how much splitstack feature is important, so I just want to stop generating currupted George. Comment Actions
I think I got what you mean, I am not proccessing the ".note.GNU-no-split-stack" at all. So it should not be discarded now then anyways. George. Comment Actions This patch covers a tricky use case. Is this actually needed? I mean if you want to do something for the split stack, why don't you support it in the linker instead of rejecting it? Even if you want reject it, this patch seems a bit too much. There is a simpler way of doing the same thing. InputFiles and Sections can be agnostic of the split stack. Instead, it can be done using a few non-member function as shown below. template <class ELFT> static bool hasSplitStack(const std::unique_ptr<ObjectFile<ELFT>> &File) { for (InputSectionBase<ELFT> *Sec : File->getSections()) if (auto *S = dyn_cast_or_null<InputSection<ELFT>>(Sec)) if (S->getSectionName() == ".note.GNU-split-stack") return true; return false; } template <class ELFT> static void checkSplitSections(SymbolTable<ELFT> &Symtab) { if (!Config->Relocatable) return; const std::vector<std::unique_ptr<ObjectFile<ELFT>>> &Files = Symtab.getObjectFiles(); bool HasSplitStack = hasSplitStack<ELFT>(Files.front()); auto Fn = [=](const std::unique_ptr<ObjectFile<ELFT>> &Obj) { return hasSplitStack<ELFT>(Obj) == HasSplitStack; }; if (!std::all_of(Files.begin(), Files.end(), Fn)) error("You cannot mix object files compiled with -fsplit-stack" " and -fno-split-stack"); } (I'm not arguing that this is what I want because I'm not sure if this feature should be in, but if it is, it can be simplified.) Comment Actions I am not sure how many people are using splitstacks (feature itself looks interesting for me though). Leaving behind known silently broken output is anyways bad. Actually main point of this patch was that I prepared a serie of patches last days that had aim to improve the -r support. George. Comment Actions It should still get the same type of handling as GNU-split-stack, though. I see no reason to handle one (even if "handle" is discarding if the output is not relocatable) but not the other. But I think the latter messages have a better idea: Simply rejecting split-stack objects (unless you plan on adding the rest of the support, including changing function prologues) seems like the most appropriate thing to do right now. Comment Actions
Thats because -r does not need to handle it. We should handle the other one for completeness, but that is not relative to this patch, so should be done separatelly.
So if we are not going to support splitstacks, I would also vote for this. (I can just update this patch, will cut excessive logic and update the tests, probably will also add few testcases). But if it is reasonable to have splitstacks, then I can implement this feature I think. Rui, Rafael, what do you think about this ? George. Comment Actions
|
That's not actually needed for this patch to work, but it seems reasonable to have ?