Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: lib/Transforms/NaCl/StripTls.cpp

Issue 29743003: Add passes for applying SFI sandboxing at the LLVM IR level Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry upload Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Transforms/NaCl/SandboxMemoryAccesses.cpp ('k') | lib/Transforms/Scalar/LowerAtomic.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- StripTls.cpp - Remove the thread_local attribute from variables-----===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // XXX
11 //
12 //===----------------------------------------------------------------------===//
13
14 // #include "llvm/IR/Function.h"
15 // #include "llvm/IR/Instructions.h"
16 // #include "llvm/IR/Intrinsics.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/Pass.h"
19 // #include "llvm/Support/raw_ostream.h"
20 #include "llvm/Transforms/NaCl.h"
21
22 using namespace llvm;
23
24 namespace {
25 // This is a ModulePass so that XXX...
26 class StripTls : public ModulePass {
27 public:
28 static char ID; // Pass identification, replacement for typeid
29 StripTls() : ModulePass(ID) {
30 initializeStripTlsPass(*PassRegistry::getPassRegistry());
31 }
32
33 virtual bool runOnModule(Module &M);
34 };
35 }
36
37 char StripTls::ID = 0;
38 INITIALIZE_PASS(StripTls, "strip-tls",
39 "Remove the thread_local attribute from variables",
40 false, false)
41
42 bool StripTls::runOnModule(Module &M) {
43 bool Changed = false;
44 for (Module::global_iterator GV = M.global_begin(), E = M.global_end();
45 GV != E;
46 ++GV) {
47 if (GV->isThreadLocal()) {
48 GV->setThreadLocal(false);
49 Changed = true;
50 }
51 }
52 return Changed;
53 }
54
55 ModulePass *llvm::createStripTlsPass() {
56 return new StripTls();
57 }
OLDNEW
« no previous file with comments | « lib/Transforms/NaCl/SandboxMemoryAccesses.cpp ('k') | lib/Transforms/Scalar/LowerAtomic.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698