[PATCH] D19376: [MC] Create unique .pdata sections for every .text section
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 10:43:41 PDT 2016
rnk added inline comments.
================
Comment at: include/llvm/MC/MCSectionCOFF.h:36
@@ +35,3 @@
+ /// The unique IDs used with the .pdata and .xdata sections created internally
+ /// by the assembler. This ID is used to ensure that there is a one-to-one
+ /// mapping from .text section to .pdata and .xdata sections. This data is
----------------
rafael wrote:
> one-to-many, no?
For every object-file level .text section, there should be one .pdata section and one .xdata section. Maybe I'll just spell that out.
================
Comment at: include/llvm/MC/MCSectionCOFF.h:39
@@ +38,3 @@
+ /// mutable because this ID is not notionally part of the section.
+ mutable unsigned WinCFISectionID = ~0U;
+
----------------
rafael wrote:
> So, this is not the unique id of this section, it is the id of the related .xdata and .pdata, correct?
>
> Why do you have to implement it like that? For ELF we store the unique id of the section itself. Then when you want to construct a .xdata or .pdata for this .text you can just use the existing unique id, no? So for example, you would end up with 3 section, .text, .xdata and .pdata all of which have an unique id of 42.
>
> Maybe the name unique id is confusing. It is not really unique, it is really just an disambiguator when the rest (name, flags) are the same.
>
But these two .text sections will have the same unique ID (~0U, the generic section id):
.section .text,"xr",discard,f
.section .text,"xr",associative,f
And we need a separate .pdata section for each, and they look like:
.section .pdata,"xr",associative,f
.section .pdata,"xr",associative,f
However, they are created implicitly when assembling the .seh_* directives.
We could assign all sections with the generic ID a non-generic unique ID on creation. We would insert two entries into the uniquing map: one with the generic ID, and one with the specific ID.
At the end of the day, I feel like it's better to just maintain this WinCFI unique ID in the .text section.
http://reviews.llvm.org/D19376
More information about the llvm-commits
mailing list