This patch adds the -mseparate-stack-seg option to enable restricting accesses to help prevent stack corruption.
Details
Diff Detail
- Build Status
Buildable 3729 Build 3729: arc lint + arc unit
Event Timeline
lib/CodeGen/TargetInfo.cpp | ||
---|---|---|
1569 ↗ | (On Diff #47511) | Hi, Searching string looks strange for me. I suppose that this string should be defined in another form. Something like |
1577 ↗ | (On Diff #47511) | You should not use 258 as a constant. It should be defined somewhere as address space enum. |
1578 ↗ | (On Diff #47511) | This line alignment does not match LLVM style. |
1580 ↗ | (On Diff #47511) | Again, not sure that I'm right. You are trying to create addressspacecast. Is it the right way to create ptrtoint + inttoptr? |
Thank you for your feedback!
lib/CodeGen/TargetInfo.cpp | ||
---|---|---|
1569 ↗ | (On Diff #47511) | I haven't quite found an example of how an option like this should be handled. String comparisons of this form are performed in clang/lib/Basic/Targets.cpp, but there they are used to initialize variables. Furthermore, all of those tests are for CPU features, whereas this one is for a particular segment configuration. |
1577 ↗ | (On Diff #47511) | I agree with this principle. However, the address space numbers for FS and GS are listed in the Clang documentation [1] and are used as literals in LLVM code. Thus, I think this patch is consistent with existing usage of address space numbers. [1] http://clang.llvm.org/docs/LanguageExtensions.html#memory-references-off-the-gs-segment |
1578 ↗ | (On Diff #47511) | I'll fix it. |
1580 ↗ | (On Diff #47511) | I first attempted to create an address space cast, but LLVM disallows that. I think it is necessary to perform the conversion through an int, but I am not entirely sure of that. |
Hi Craig,
Could you have a look? I am not confident enough with clang to give more feedback than Elena.
Cheers,
-Quentin
Removed the portions that are specific to 32-bit segmentation. I plan to resubmit those later as a separate patch.