diff options
author | 2021-06-27 13:10:53 -0500 | |
---|---|---|
committer | 2021-06-27 13:10:53 -0500 | |
commit | 77e9d0dd89bd660237a8f239c03062f1ffa009d7 (patch) | |
tree | bdfb62fc4f0bb294d84bd9793f1217f75156e6af | |
parent | tweaks (diff) | |
parent | gcov: fix build failure with gcc 11.1.0 (diff) | |
download | firejail-77e9d0dd89bd660237a8f239c03062f1ffa009d7.tar.gz firejail-77e9d0dd89bd660237a8f239c03062f1ffa009d7.tar.zst firejail-77e9d0dd89bd660237a8f239c03062f1ffa009d7.zip |
Merge pull request #4373 from kmk3/gcov-fix-build-gcc11
gcov: fix build failure with gcc 11.1.0
-rw-r--r-- | src/firejail/appimage.c | 2 | ||||
-rw-r--r-- | src/firejail/chroot.c | 2 | ||||
-rw-r--r-- | src/firejail/fs.c | 2 | ||||
-rw-r--r-- | src/firejail/fs_mkdir.c | 2 | ||||
-rw-r--r-- | src/firejail/ls.c | 2 | ||||
-rw-r--r-- | src/firejail/main.c | 2 | ||||
-rw-r--r-- | src/firejail/profile.c | 2 | ||||
-rw-r--r-- | src/firejail/rlimit.c | 2 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 2 | ||||
-rw-r--r-- | src/firejail/util.c | 2 | ||||
-rw-r--r-- | src/firemon/interface.c | 2 | ||||
-rw-r--r-- | src/firemon/netstats.c | 2 | ||||
-rw-r--r-- | src/firemon/procevent.c | 2 | ||||
-rw-r--r-- | src/firemon/top.c | 2 | ||||
-rw-r--r-- | src/include/gcov_wrapper.h | 40 |
15 files changed, 54 insertions, 14 deletions
diff --git a/src/firejail/appimage.c b/src/firejail/appimage.c index a96415985..056640eec 100644 --- a/src/firejail/appimage.c +++ b/src/firejail/appimage.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | #ifdef HAVE_GCOV | 31 | #ifdef HAVE_GCOV |
32 | #include <gcov.h> | 32 | #include "../include/gcov_wrapper.h" |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | static char *devloop = NULL; // device file | 35 | static char *devloop = NULL; // device file |
diff --git a/src/firejail/chroot.c b/src/firejail/chroot.c index edc31cdea..0d4baa618 100644 --- a/src/firejail/chroot.c +++ b/src/firejail/chroot.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifdef HAVE_GCOV | 32 | #ifdef HAVE_GCOV |
33 | #include <gcov.h> | 33 | #include "../include/gcov_wrapper.h" |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | // exit if error | 36 | // exit if error |
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 4ae7dbfa4..806fa9249 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #ifdef HAVE_GCOV | 36 | #ifdef HAVE_GCOV |
37 | #include <gcov.h> | 37 | #include "../include/gcov_wrapper.h" |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define MAX_BUF 4096 | 40 | #define MAX_BUF 4096 |
diff --git a/src/firejail/fs_mkdir.c b/src/firejail/fs_mkdir.c index bbc2aa938..0195435f9 100644 --- a/src/firejail/fs_mkdir.c +++ b/src/firejail/fs_mkdir.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | 27 | ||
28 | #ifdef HAVE_GCOV | 28 | #ifdef HAVE_GCOV |
29 | #include <gcov.h> | 29 | #include "../include/gcov_wrapper.h" |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | static void check(const char *fname) { | 32 | static void check(const char *fname) { |
diff --git a/src/firejail/ls.c b/src/firejail/ls.c index 6ee557648..ae7e89741 100644 --- a/src/firejail/ls.c +++ b/src/firejail/ls.c | |||
@@ -32,7 +32,7 @@ | |||
32 | //#include <stdlib.h> | 32 | //#include <stdlib.h> |
33 | 33 | ||
34 | #ifdef HAVE_GCOV | 34 | #ifdef HAVE_GCOV |
35 | #include <gcov.h> | 35 | #include "../include/gcov_wrapper.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | // uid/gid cache | 38 | // uid/gid cache |
diff --git a/src/firejail/main.c b/src/firejail/main.c index 374afed11..7b32f6f07 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef HAVE_GCOV | 47 | #ifdef HAVE_GCOV |
48 | #include <gcov.h> | 48 | #include "../include/gcov_wrapper.h" |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #ifdef __ia64__ | 51 | #ifdef __ia64__ |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 5b1478918..7b21eb387 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
25 | 25 | ||
26 | #ifdef HAVE_GCOV | 26 | #ifdef HAVE_GCOV |
27 | #include <gcov.h> | 27 | #include "../include/gcov_wrapper.h" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | extern char *xephyr_screen; | 30 | extern char *xephyr_screen; |
diff --git a/src/firejail/rlimit.c b/src/firejail/rlimit.c index dd6fec972..2666486fa 100644 --- a/src/firejail/rlimit.c +++ b/src/firejail/rlimit.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sys/resource.h> | 22 | #include <sys/resource.h> |
23 | 23 | ||
24 | #ifdef HAVE_GCOV | 24 | #ifdef HAVE_GCOV |
25 | #include <gcov.h> | 25 | #include "../include/gcov_wrapper.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | void set_rlimits(void) { | 28 | void set_rlimits(void) { |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 95be3335f..99abce57f 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #ifdef HAVE_GCOV | 52 | #ifdef HAVE_GCOV |
53 | #include <gcov.h> | 53 | #include "../include/gcov_wrapper.h" |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | static int force_nonewprivs = 0; | 56 | static int force_nonewprivs = 0; |
diff --git a/src/firejail/util.c b/src/firejail/util.c index 8fcaf3f7b..55998e6c3 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -45,7 +45,7 @@ | |||
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef HAVE_GCOV | 47 | #ifdef HAVE_GCOV |
48 | #include <gcov.h> | 48 | #include "../include/gcov_wrapper.h" |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #define MAX_GROUPS 1024 | 51 | #define MAX_GROUPS 1024 |
diff --git a/src/firemon/interface.c b/src/firemon/interface.c index b93d4a5a2..372cdee41 100644 --- a/src/firemon/interface.c +++ b/src/firemon/interface.c | |||
@@ -34,7 +34,7 @@ | |||
34 | //#include <linux/if_bridge.h> | 34 | //#include <linux/if_bridge.h> |
35 | 35 | ||
36 | #ifdef HAVE_GCOV | 36 | #ifdef HAVE_GCOV |
37 | #include <gcov.h> | 37 | #include "../include/gcov_wrapper.h" |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | // print IP addresses for all interfaces | 40 | // print IP addresses for all interfaces |
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c index 23d228e26..bc951aa26 100644 --- a/src/firemon/netstats.c +++ b/src/firemon/netstats.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #ifdef HAVE_GCOV | 27 | #ifdef HAVE_GCOV |
28 | #include <gcov.h> | 28 | #include "../include/gcov_wrapper.h" |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define MAXBUF 4096 | 31 | #define MAXBUF 4096 |
diff --git a/src/firemon/procevent.c b/src/firemon/procevent.c index 4e809681e..79f487582 100644 --- a/src/firemon/procevent.c +++ b/src/firemon/procevent.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <sys/uio.h> | 31 | #include <sys/uio.h> |
32 | 32 | ||
33 | #ifdef HAVE_GCOV | 33 | #ifdef HAVE_GCOV |
34 | #include <gcov.h> | 34 | #include "../include/gcov_wrapper.h" |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define PIDS_BUFLEN 4096 | 37 | #define PIDS_BUFLEN 4096 |
diff --git a/src/firemon/top.c b/src/firemon/top.c index 9d6f34991..d0f911e60 100644 --- a/src/firemon/top.c +++ b/src/firemon/top.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #ifdef HAVE_GCOV | 27 | #ifdef HAVE_GCOV |
28 | #include <gcov.h> | 28 | #include "../include/gcov_wrapper.h" |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | static unsigned pgs_rss = 0; | 31 | static unsigned pgs_rss = 0; |
diff --git a/src/include/gcov_wrapper.h b/src/include/gcov_wrapper.h new file mode 100644 index 000000000..2f409309d --- /dev/null +++ b/src/include/gcov_wrapper.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2021 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef GCOV_WRAPPER_H | ||
22 | #define GCOV_WRAPPER_H | ||
23 | |||
24 | #include <gcov.h> | ||
25 | |||
26 | /* | ||
27 | * __gcov_flush was removed on gcc 11.1.0 (as it's no longer needed), but it | ||
28 | * appears to be the safe/"correct" way to do things on previous versions (as | ||
29 | * it ensured proper locking, which is now done elsewhere). Thus, keep using | ||
30 | * it in the code and ensure that it exists, in order to support gcc <11.1.0 | ||
31 | * and gcc >=11.1.0, respectively. | ||
32 | */ | ||
33 | #if __GNUC__ > 11 || (__GNUC__ == 11 && __GNUC_MINOR__ >= 1) | ||
34 | static void __gcov_flush(void) { | ||
35 | __gcov_dump(); | ||
36 | __gcov_reset(); | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #endif /* GCOV_WRAPPER_H */ | ||