[PATCH] D28526: [ARM] Add diagnostics when initialization global variables with ropi/rwpi
Weiming Zhao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 12:09:33 PST 2017
weimingz created this revision.
weimingz added reviewers: olista01, jmolloy.
weimingz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.
This patch adds diagnoses when initializing a global variable using the address of another global variable that uses ROPI/RWPI relocation model.
For example,
int a;
extern void foo();
int *x = &a; // we cannot statically initialize x with -frwpi
void *y = &foo(); // we can't statically initialize y with -fropi
The above code will trigger diagnoses like:
error: 'x' cannot be initialized using address of 'a' with 'rwpi' relocation
https://reviews.llvm.org/D28526
Files:
include/clang/Basic/DiagnosticSemaKinds.td
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
test/CodeGen/arm-ropi-rwpi.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28526.83844.patch
Type: text/x-patch
Size: 7522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170110/25fada89/attachment.bin>
More information about the cfe-commits
mailing list