It is used by addon for the rap_plugin to forbid
function casting in linux-secure.
Change-Id: If99011ed63a4067e5b917ec2ab947412cec98dba
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2086
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,57 @@ |
0 |
+diff -Naur gcc-5.3.0.orig/gcc/c/c-typeck.c gcc-5.3.0/gcc/c/c-typeck.c |
|
1 |
+--- gcc-5.3.0.orig/gcc/c/c-typeck.c 2015-10-05 05:35:20.000000000 -0700 |
|
2 |
+@@ -69,6 +69,8 @@ |
|
3 |
+ #include "cilk.h" |
|
4 |
+ #include "wide-int.h" |
|
5 |
+ #include "gomp-constants.h" |
|
6 |
++#include "plugin-api.h" |
|
7 |
++#include "plugin.h" |
|
8 |
+ |
|
9 |
+ /* Possible cases of implicit bad conversions. Used to select |
|
10 |
+ diagnostic messages in convert_for_assignment. */ |
|
11 |
+@@ -5029,6 +5031,12 @@ |
|
12 |
+ return error_mark_node; |
|
13 |
+ } |
|
14 |
+ |
|
15 |
++ { |
|
16 |
++ tree cast_info[] {type, TREE_TYPE(value)}; |
|
17 |
++ invoke_plugin_callbacks (PLUGIN_TYPE_CAST, cast_info); |
|
18 |
++ } |
|
19 |
++ |
|
20 |
++ |
|
21 |
+ if (type == TYPE_MAIN_VARIANT (TREE_TYPE (value))) |
|
22 |
+ { |
|
23 |
+ if (TREE_CODE (type) == RECORD_TYPE |
|
24 |
+diff -Naur gcc-5.3.0.orig/gcc/plugin.c gcc-5.3.0/gcc/plugin.c |
|
25 |
+--- gcc-5.3.0.orig/gcc/plugin.c 2015-01-30 08:15:00.000000000 -0800 |
|
26 |
+@@ -462,6 +462,7 @@ |
|
27 |
+ case PLUGIN_EARLY_GIMPLE_PASSES_END: |
|
28 |
+ case PLUGIN_NEW_PASS: |
|
29 |
+ case PLUGIN_INCLUDE_FILE: |
|
30 |
++ case PLUGIN_TYPE_CAST: |
|
31 |
+ { |
|
32 |
+ struct callback_info *new_callback; |
|
33 |
+ if (!callback) |
|
34 |
+@@ -540,6 +541,7 @@ |
|
35 |
+ case PLUGIN_EARLY_GIMPLE_PASSES_END: |
|
36 |
+ case PLUGIN_NEW_PASS: |
|
37 |
+ case PLUGIN_INCLUDE_FILE: |
|
38 |
++ case PLUGIN_TYPE_CAST: |
|
39 |
+ { |
|
40 |
+ /* Iterate over every callback registered with this event and |
|
41 |
+ call it. */ |
|
42 |
+diff -Naur gcc-5.3.0.orig/gcc/plugin.def gcc-5.3.0/gcc/plugin.def |
|
43 |
+--- gcc-5.3.0.orig/gcc/plugin.def 2015-01-05 04:33:28.000000000 -0800 |
|
44 |
+@@ -94,6 +94,9 @@ |
|
45 |
+ as a const char* pointer. */ |
|
46 |
+ DEFEVENT (PLUGIN_INCLUDE_FILE) |
|
47 |
+ |
|
48 |
++/* Called when expression is casted to some type. */ |
|
49 |
++DEFEVENT (PLUGIN_TYPE_CAST) |
|
50 |
++ |
|
51 |
+ /* When adding a new hard-coded plugin event, don't forget to edit in |
|
52 |
+ file plugin.c the functions register_callback and |
|
53 |
+ invoke_plugin_callbacks_full accordingly! */ |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
Summary: Contains the GNU compiler collection |
3 | 3 |
Name: gcc |
4 | 4 |
Version: 5.3.0 |
5 |
-Release: 4%{?dist} |
|
5 |
+Release: 5%{?dist} |
|
6 | 6 |
License: GPLv2+ |
7 | 7 |
URL: http://gcc.gnu.org |
8 | 8 |
Group: Development/Tools |
... | ... |
@@ -10,6 +10,7 @@ Vendor: VMware, Inc. |
10 | 10 |
Distribution: Photon |
11 | 11 |
Source0: http://ftp.gnu.org/gnu/gcc/%{name}-%{version}/%{name}-%{version}.tar.bz2 |
12 | 12 |
%define sha1 gcc=0612270b103941da08376df4d0ef4e5662a2e9eb |
13 |
+Patch0: PLUGIN_TYPE_CAST.patch |
|
13 | 14 |
Requires: libstdc++-devel = %{version}-%{release} |
14 | 15 |
Requires: libgcc-devel = %{version}-%{release} |
15 | 16 |
Requires: libgomp-devel = %{version}-%{release} |
... | ... |
@@ -71,6 +72,7 @@ This package contains development headers and static library for libgomp |
71 | 71 |
|
72 | 72 |
%prep |
73 | 73 |
%setup -q |
74 |
+%patch0 -p1 |
|
74 | 75 |
sed -i '/*cpp:/s/^/# /' `dirname $(gcc --print-libgcc-file-name)`/../specs |
75 | 76 |
sed -i '/Ofast:-D_FORTIFY_SOURCE=2/s/^/# /' `dirname $(gcc --print-libgcc-file-name)`/../specs |
76 | 77 |
|
... | ... |
@@ -91,7 +93,6 @@ SED=sed \ |
91 | 91 |
--enable-plugin \ |
92 | 92 |
--with-system-zlib |
93 | 93 |
# --disable-silent-rules |
94 |
-#sed -i '/-D_FORTIFY_SOURCE=2 for preprocessor/,+2d' `dirname $(gcc --print-libgcc-file-name)`/../specs |
|
95 | 94 |
make |
96 | 95 |
%install |
97 | 96 |
pushd ../gcc-build |
... | ... |
@@ -214,6 +215,8 @@ make %{?_smp_mflags} check |
214 | 214 |
%endif |
215 | 215 |
|
216 | 216 |
%changelog |
217 |
+* Wed Feb 22 2017 Alexey Makhalov <amakhalov@vmware.com> 5.3.0-5 |
|
218 |
+- Added new plugin entry point: PLUGIN_TYPE_CAST (.patch) |
|
217 | 219 |
* Thu Sep 8 2016 Alexey Makhalov <amakhalov@vmware.com> 5.3.0-4 |
218 | 220 |
- Enable plugins and linker build id. |
219 | 221 |
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 5.3.0-3 |