[PATCH] compiler-rt: Fix windows executable stack handling

Saleem Abdulrasool compnerd at compnerd.org
Sat Sep 6 14:18:01 PDT 2014


On Sat, Sep 6, 2014 at 11:50 AM, David Majnemer <david.majnemer at gmail.com>
wrote:

> We can't remove it without breaking compatibility with libgcc.


If we care about compatibility with libgcc for this, then rather than just
eliding the function, we should implement it.  It isn't particularly
difficult, a combination of VirtualQuery and VirtualProtect should do the
trick.  However, IIRC, this won't work on Windows ARM as VirtualProtect is
not available there.


>
> On Saturday, September 6, 2014, Reid Kleckner <rnk at google.com> wrote:
>
>> I think less build system complexity in both CMake and autoconf is
>> better. The best would be to delete this built-in altogether. :-)
>>
>> Sent from phone
>> On Sep 5, 2014 7:04 PM, "Saleem Abdulrasool" <compnerd at compnerd.org>
>> wrote:
>>
>>> On Fri, Sep 5, 2014 at 4:37 PM, Stephen Hines <srhines at google.com>
>>> wrote:
>>>
>>>> Does this look better?
>>>>
>>>
>>> Depends on how you squint :-).  I find it ugly, but correct.
>>>
>>> There is a patch that I have on phab that adds support for the Makefile
>>> based build system for building compiler-rt for Windows x86, x86_64, and
>>> ARM.  This file is entirely elided, which you have done.  I think dropping
>>> the file in the build system is nicer, but if that doesn't work, then this
>>> is fine.
>>>
>>> Thanks,
>>>> Steve
>>>>
>>>> From: Stephen Hines <srhines at google.com>
>>>> Date: Tue, 2 Sep 2014 14:34:58 -0700
>>>> Subject: [PATCH] Remove enable_execute_stack functionality on Windows.
>>>>
>>>> ---
>>>>  lib/builtins/enable_execute_stack.c | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/lib/builtins/enable_execute_stack.c
>>>> b/lib/builtins/enable_execute_stack.c
>>>> index 63d836b..c02be2a 100644
>>>> --- a/lib/builtins/enable_execute_stack.c
>>>> +++ b/lib/builtins/enable_execute_stack.c
>>>> @@ -8,6 +8,7 @@
>>>>   *
>>>> ===----------------------------------------------------------------------===
>>>>   */
>>>>
>>>> +#if !defined(_WIN32)
>>>>  #include "int_lib.h"
>>>>
>>>>  #include <sys/mman.h>
>>>> @@ -56,3 +57,5 @@ __enable_execute_stack(void* addr)
>>>>   size_t length = endPage - startPage;
>>>>   (void) mprotect((void *)startPage, length, PROT_READ | PROT_WRITE |
>>>> PROT_EXEC);
>>>>  }
>>>> +
>>>> +#endif
>>>> --
>>>> 2.1.0.rc2.206.gedb03e5
>>>>
>>>>
>>>>
>>>> On Fri, Sep 5, 2014 at 1:36 PM, Reid Kleckner <rnk at google.com> wrote:
>>>>
>>>>> Wow. It looks like LLVM doesn't reference this builtin. GCC however
>>>>> references it for nested function trampolines. It's not clear to me if we
>>>>> need to support that.
>>>>>
>>>>> In the short term, I would just ifdef out the whole file on Windows.
>>>>> Feel free to just commit that if it makes your build work. In the longer
>>>>> term, I'd like to know if we can just delete this builtin.
>>>>>
>>>>>
>>>>> On Fri, Sep 5, 2014 at 1:13 PM, Stephen Hines <srhines at google.com>
>>>>> wrote:
>>>>>
>>>>>> Ping.
>>>>>>
>>>>>>
>>>>>> On Tue, Sep 2, 2014 at 2:41 PM, Stephen Hines <srhines at google.com>
>>>>>> wrote:
>>>>>>
>>>>>>> The following patch allows compiler-rt to build/execute under a
>>>>>>> mingw build for windows. The existing code (ifdef-ed out on windows)
>>>>>>> doesn't build or execute correctly for this environment. Please take a look
>>>>>>> and let me know if it is ok to commit it.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Steve
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> llvm-commits mailing list
>>>>>> llvm-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>>
>>>
>>>
>>> --
>>> Saleem Abdulrasool
>>> compnerd (at) compnerd (dot) org
>>>
>>


-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140906/d2dddb8e/attachment.html>


More information about the llvm-commits mailing list