[llvm-commits] [patch] Fix PR5094: -fstack-protector fails to link on Linux/x86

Bill Wendling wendling at apple.com
Mon Jul 5 14:28:49 PDT 2010


This is in the "Generic" folder. Please don't change it like this. If the test as is can no longer be done generically, then we should find another solution.

--- a/test/CodeGen/Generic/stack-protector.ll
+++ b/test/CodeGen/Generic/stack-protector.ll
@@ -1,5 +1,7 @@
-; RUN: llc < %s -o - | grep {__stack_chk_guard}
-; RUN: llc < %s -o - | grep {__stack_chk_fail}
+; RUN: llc -march=arm < %s -o - | grep {__stack_chk_guard}
+; RUN: llc -march=arm < %s -o - | grep {__stack_chk_fail}
+; Linux/x86 stores the stack cookie in a weird place. So we force an arbitrary
+; non-x86 test to make sure codegen uses the generic case.
 
 @"\01LC" = internal constant [11 x i8] c"buf == %s\0A\00"		; <[11 x i8]*> [#uses=1]

-bw

On Jul 5, 2010, at 12:53 PM, Nelson Elhage wrote:

> Rebased to current mainline.
> 
> - Nelson
> 
> <stack-protector-linux.diff>
> On Mon, 5 Jul 2010 11:22:52 -0700, Eric Christopher <echristo at apple.com> wrote:
>> 
>> On Jul 5, 2010, at 11:16 AM, Eric Christopher wrote:
>> 
>>> 
>>> On Jul 5, 2010, at 11:11 AM, Nelson Elhage wrote:
>>> 
>>>> <stack-protector-linux.diff>
>>> 
>>> I'm not against this way in general.
>>> 
>>> You can use "isELF" in the Subtarget area instead of including triple though.  If you can make that change real fast that would be great.
>> 
>> As has been pointed out BSD is also elf.  I need to fix some comments and then give me a second to get things set up as far as the subtarget.
>> 
>> -eric
> From: Nelson Elhage <nelhage at nelhage.com>
> Subject: Re: [llvm-commits] [patch] Fix PR5094: -fstack-protector fails to link on Linux/x86
> To: Eric Christopher <echristo at apple.com>
> Cc: llvm-commits at cs.uiuc.edu
> Bcc: nelhage at mit.edu
> In-Reply-To: <9396FE2A-1D59-4AAC-A5A8-F10DB3FA34FF at apple.com>
> References: <201006190247.o5J2lCxL009172 at outgoing.mit.edu> <87wrt9ssrh.fsf at mit.edu> <9396FE2A-1D59-4AAC-A5A8-F10DB3FA34FF at apple.com>
> 
> On Mon, 5 Jul 2010 11:16:51 -0700, Eric Christopher <echristo at apple.com> wrote:
>> 
>> On Jul 5, 2010, at 11:11 AM, Nelson Elhage wrote:
>> 
>>> <stack-protector-linux.diff>
>> 
>> I'm not against this way in general.
>> 
>> You can use "isELF" in the Subtarget area instead of including triple though.  If you can make that change real fast that would be great.
>> 
>> -eric
> From: Nelson Elhage <nelhage at nelhage.com>
> Subject: Re: [llvm-commits] [patch] Fix PR5094: -fstack-protector fails to link  on Linux/x86
> To: llvm-commits at cs.uiuc.edu
> Bcc: nelhage at mit.edu
> In-Reply-To: <87wrt9ssrh.fsf at mit.edu>
> References: <201006190247.o5J2lCxL009172 at outgoing.mit.edu> <87wrt9ssrh.fsf at mit.edu>
> 
> On Mon, 05 Jul 2010 14:11:46 -0400, Nelson Elhage <nelhage at nelhage.com> wrote:
>> [bump] I haven't gotten an reply to this, and IRC suggested a reminder
>> would be appropriate.
>> 
>> I'm happy to rewrite this using a different approach if something else
>> would be more appropriate, but I'd love to see this bug fixed since it
>> affects my ability to compile projects I work on with clang.
>> 
> From: Nelson Elhage <nelhage at nelhage.com>
> Subject: Re: [llvm-commits] [patch] Fix PR5094: -fstack-protector fails to link  on Linux/x86
> To: llvm-commits at cs.uiuc.edu
> Bcc: nelhage at mit.edu
> In-Reply-To: <201006190247.o5J2lCxL009172 at outgoing.mit.edu>
> References: <201006190247.o5J2lCxL009172 at outgoing.mit.edu>
> 
> On Fri, 18 Jun 2010 22:47:17 -0400 (EDT), Nelson Elhage <nelhage at nelhage.com> wrote:
>> This patch adds a hook to TargetLowering to indicate whether the stack protector
>> cookie is stored in a non-standard place.
>> 
>> Code-diving glibc, it appears that in general it stores the stack cookie off of
>> the TCB header. I'm not sure if there's a more generic solution than the
>> address-space/offset approach in this patch for accessing the TCB header in the
>> generated IR.
>> 
> <stack-protector-linux.diff>
>> 
>> _______________________________________________
>> 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





More information about the llvm-commits mailing list