Chris Lattner
18ba4703b0
tighten up this code.
...
llvm-svn: 107670
2010-07-06 15:59:27 +00:00
Eric Christopher
e873e9978c
Fix up -fstack-protector on linux to use the segment
...
registers. Split out testcases per architecture and os
now.
Patch from Nelson Elhage.
llvm-svn: 107640
2010-07-06 05:18:56 +00:00
Duncan Sands
2acaf3609c
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Benjamin Kramer
0ba7479f2c
Move remaining stuff to the isInteger predicate.
...
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Nick Lewycky
711c726c97
Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
...
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.
llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Bill Wendling
283fb69c0a
Neuter stack protectors by only checking character arrays. This is what GCC
...
does.
llvm-svn: 84916
2009-10-23 00:01:05 +00:00
Owen Anderson
9df206d02d
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
4483fbda5e
Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
...
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Owen Anderson
8c85061ee6
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Owen Anderson
49226b1075
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
...
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Duncan Sands
f7af13b2d4
Rename PaddedSize to AllocSize, in the hope that this
...
will make it more obvious what it represents, and stop
it being confused with the StoreSize.
llvm-svn: 71349
2009-05-09 07:06:46 +00:00
Bill Wendling
5ddde1a24c
When we split a basic block, there's a default branch to the newly created BB.
...
Delete this default branch, because we're going to generate our own.
llvm-svn: 66234
2009-03-06 01:41:15 +00:00
Duncan Sands
bcdbfb63dc
Rename getABITypeSize to getTypePaddedSize, as
...
suggested by Chris.
llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Bill Wendling
3460a79979
Rename stackprotector_create intrinsic to stackprotector.
...
llvm-svn: 59519
2008-11-18 11:01:33 +00:00
Bill Wendling
485d094231
Remove the stackprotector_check intrinsic. Use a volatile load instead.
...
llvm-svn: 59504
2008-11-18 07:30:57 +00:00
Bill Wendling
3a50ecd70f
- Use "moveAfter" instead of "remove/insert" of a basic block.
...
- Use less indentation in coding.
- Shorten description.
- Update comments.
- Move code around
llvm-svn: 59496
2008-11-18 05:32:11 +00:00
Bill Wendling
f5b264a64b
Implement stack protectors as function attributes: "ssp" and "sspreq".
...
llvm-svn: 59202
2008-11-13 01:02:14 +00:00
Bill Wendling
d3c149eb90
Small simplification. Use the iterator already present as the insertion point.
...
llvm-svn: 59008
2008-11-10 23:38:59 +00:00
Bill Wendling
0421da9e9e
- Make sure that we don't over-increment the iterator when going through the
...
basic blocks.
- Minor code clean-up.
llvm-svn: 59002
2008-11-10 21:13:10 +00:00
Bill Wendling
3fe9fef0da
- Modify the stack protector algorithm so that the stack slot is allocated in
...
LLVM IR code and not in the selection DAG ISel. This is a cleaner solution.
- Fix the heuristic for determining if protectors are necessary. The previous
one wasn't checking the proper type size.
llvm-svn: 58824
2008-11-07 01:23:58 +00:00
Bill Wendling
54a5c87823
Remove unneeded header file.
...
llvm-svn: 58823
2008-11-06 23:56:59 +00:00
Bill Wendling
70e06738b4
Don't build a vector of returns. Just modify the Function in the loop.
...
llvm-svn: 58822
2008-11-06 23:55:49 +00:00
Bill Wendling
1e6576e1e0
The size limit is for individual arrays. So if any array has more than 8 bytes
...
in it, then emit stack protectors.
llvm-svn: 58819
2008-11-06 22:18:44 +00:00
Bill Wendling
b6e2d60e7a
- Rename stackprotector_{prologue,epilogue} to stackprotector_{create,check}.
...
- Get rid of "HasStackProtector" in MachineFrameInfo.
- Modify intrinsics to tell which are doing what with memory.
llvm-svn: 58799
2008-11-06 07:23:03 +00:00
Bill Wendling
489791a127
Adjust the stack protector heuristic to care about only arrays or calls to
...
"alloca".
llvm-svn: 58792
2008-11-06 02:38:58 +00:00
Bill Wendling
08905ed703
Implement the stack protector stack accesses via intrinsics:
...
- stackprotector_prologue creates a stack object and stores the guard there.
- stackprotector_epilogue reads the stack guard from the stack position created
by stackprotector_prologue.
- The PrologEpilogInserter was changed to make sure that the stack guard is
first on the stack frame.
llvm-svn: 58791
2008-11-06 02:29:10 +00:00
Bill Wendling
986e386794
Remove dead variable.
...
llvm-svn: 58741
2008-11-05 00:56:35 +00:00
Bill Wendling
8c86d20576
Simplify the allocated size calculation.
...
llvm-svn: 58740
2008-11-05 00:54:27 +00:00
Bill Wendling
2461aaa183
Fix comment
...
llvm-svn: 58739
2008-11-05 00:46:15 +00:00
Bill Wendling
e73f31f526
Some code simplification. It now doesn't generate a prologue if the epilogue
...
isn't going to be generated.
llvm-svn: 58734
2008-11-05 00:00:21 +00:00
Bill Wendling
214f515922
Small simplification of the stack guard type.
...
llvm-svn: 58728
2008-11-04 22:54:43 +00:00
Bill Wendling
79a8798e07
- Add a "getOrInsertGlobal" method to the Module class. This acts similarly to
...
"getOrInsertFunction" in that it either adds a new declaration of the global
and returns it, or returns the current one -- optionally casting it to the
correct type.
- Use the new getOrInsertGlobal in the stack protector code.
- Use "splitBasicBlock" in the stack protector code.
llvm-svn: 58727
2008-11-04 22:51:24 +00:00
Bill Wendling
ae168b2c83
Update in response to feedback from Chris:
...
- Use enums instead of magic numbers.
- Rework algorithm to use the bytes size from the target to determine when to
emit stack protectors.
- Get rid of "propolice" in any comments.
- Renamed an option to its expanded form.
- Other miscellanenous changes.
More changes will come after this.
llvm-svn: 58723
2008-11-04 21:53:09 +00:00
Bill Wendling
0f3f36688b
Initial checkin for stack protectors. Here's what it does:
...
* The prologue is modified to read the __stack_chk_guard global and insert it
onto the stack.
* The epilogue is modified to read the stored guard from the stack and compare
it to the original __stack_chk_guard value. If they differ, then the
__stack_chk_fail() function is called.
* The stack protector needs to be first on the stack (after the parameters) to
catch any stack-smashing activities.
Front-end support will follow after a round of beta testing.
llvm-svn: 58673
2008-11-04 02:10:20 +00:00