* [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:30 ` Cyril Hrubis
2020-04-15 9:28 ` [LTP] [RFC PATCH 2/8] controllers: Simplify fullpath definition Petr Vorel
` (7 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
-fno-common is a default for gcc-10 and if not used on many targets
implies a speed and code size penalty on global variable references.
It requires either defining variable in header as extern or moving it
to C source.
https://gcc.gnu.org/gcc-10/porting_to.html
Due different TCID handling in legacy API (which defines TCID in the
test source) and new API (TCID defined in the library header) it's not
enough to simply move that definition into tst_test.c because that would
mean that old API test would end up with multiple definitions one in the
corresponding test and one in the new library library code. To workaround
this added definition in tst_test.c with weak linker attribute.
Keeping TCID as extern in tst_test.h is needed because it's used in some
new API tests (e.g. CHECK_MFD_NEW() in memfd_create01.c).
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Tested-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/tst_test.h | 6 ++----
lib/tst_test.c | 5 +++++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/tst_test.h b/include/tst_test.h
index 42c02b549..fa54f9cde 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -319,9 +319,7 @@ int main(int argc, char *argv[])
#define TST_TEST_TCONF(message) \
static struct tst_test test = { .tconf_msg = message } \
-/*
- * This is a hack to make the testcases link without defining TCID
- */
-const char *TCID;
+
+extern const char *TCID;
#endif /* TST_TEST_H__ */
diff --git a/lib/tst_test.c b/lib/tst_test.c
index e502c2c1a..64cd3ac33 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -32,6 +32,11 @@
#include "old_device.h"
#include "old_tmpdir.h"
+/*
+ * Hack to get TCID defined in newlib tests
+ */
+const char *TCID __attribute__((weak));
+
#define LINUX_GIT_URL "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id="
#define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common
2020-04-15 9:28 ` [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common Petr Vorel
@ 2020-04-15 9:30 ` Cyril Hrubis
2020-04-15 9:49 ` Petr Vorel
0 siblings, 1 reply; 14+ messages in thread
From: Cyril Hrubis @ 2020-04-15 9:30 UTC (permalink / raw)
To: ltp
Hi!
> +extern const char *TCID;
Do we really need this extern or can we remove it?
> #endif /* TST_TEST_H__ */
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index e502c2c1a..64cd3ac33 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -32,6 +32,11 @@
> #include "old_device.h"
> #include "old_tmpdir.h"
--
chrubis@suse.cz
^ permalink raw reply [flat|nested] 14+ messages in thread
* [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common
2020-04-15 9:30 ` Cyril Hrubis
@ 2020-04-15 9:49 ` Petr Vorel
2020-04-15 10:49 ` Cyril Hrubis
0 siblings, 1 reply; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:49 UTC (permalink / raw)
To: ltp
Hi Cyril,
> > +extern const char *TCID;
> Do we really need this extern or can we remove it?
Some code is using TCID, not sure if it could be replaced by something else or
whether is worth to add API function which returns TCID.
In file included from memfd_create01.c:17:
memfd_create01.c: In function ?verify_memfd_create?:
memfd_create01.c:244:21: error: ?TCID? undeclared (first use in this function)
244 | fd = CHECK_MFD_NEW(TCID, MFD_DEF_SIZE, tc->flags);
| ^~~~
---
In file included from testcases/kernel/mem/include/mem.h:4,
from overcommit_memory.c:72:
overcommit_memory.c: In function ?setup?:
overcommit_memory.c:105:33: error: ?TCID? undeclared (first use in this function)
105 | "can't support to test %s", TCID);
| ^~~~
---
In file included from ima_mmap.c:9:
ima_mmap.c: In function ?run?:
ima_mmap.c:36:43: error: ?TCID? undeclared (first use in this function)
36 | tst_brk(TBROK, "Usage: %s -f filename", TCID);
| ^~~~
Kind regards,
Petr
^ permalink raw reply [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common
2020-04-15 9:49 ` Petr Vorel
@ 2020-04-15 10:49 ` Cyril Hrubis
2020-04-15 11:08 ` Petr Vorel
0 siblings, 1 reply; 14+ messages in thread
From: Cyril Hrubis @ 2020-04-15 10:49 UTC (permalink / raw)
To: ltp
Hi!
> > > +extern const char *TCID;
>
> > Do we really need this extern or can we remove it?
> Some code is using TCID, not sure if it could be replaced by something else or
> whether is worth to add API function which returns TCID.
>
> In file included from memfd_create01.c:17:
> memfd_create01.c: In function ???verify_memfd_create???:
> memfd_create01.c:244:21: error: ???TCID??? undeclared (first use in this function)
> 244 | fd = CHECK_MFD_NEW(TCID, MFD_DEF_SIZE, tc->flags);
> | ^~~~
> ---
This one is used as a unique test identifier, we can hardcode something
as "ltp_memfd_create01" there instead.
>
> In file included from testcases/kernel/mem/include/mem.h:4,
> from overcommit_memory.c:72:
> overcommit_memory.c: In function ???setup???:
> overcommit_memory.c:105:33: error: ???TCID??? undeclared (first use in this function)
> 105 | "can't support to test %s", TCID);
> | ^~~~
> ---
>
> In file included from ima_mmap.c:9:
> ima_mmap.c: In function ???run???:
> ima_mmap.c:36:43: error: ???TCID??? undeclared (first use in this function)
> 36 | tst_brk(TBROK, "Usage: %s -f filename", TCID);
> | ^~~~
Hmm these two are using the TCID as a test binary name, which kind of
works by accident. Because:
1. The library uses argv[0] to initialize TCID
2. Then TCID is used as a prefix for the temporary directory
the test has created and also for filename on tmpfs
There is no guarantee that TCID is equal to argv[0], it's only supposed
to be unique identifier for a test.
So I would rather be for removing TCID from these tests. The question is
if we want to replace it with something that is guaranteed to contain
the test binary name or remove it completely.
--
chrubis@suse.cz
^ permalink raw reply [flat|nested] 14+ messages in thread
* [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common
2020-04-15 10:49 ` Cyril Hrubis
@ 2020-04-15 11:08 ` Petr Vorel
0 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 11:08 UTC (permalink / raw)
To: ltp
Hi Cyril,
> > In file included from memfd_create01.c:17:
> > memfd_create01.c: In function ???verify_memfd_create???:
> > memfd_create01.c:244:21: error: ???TCID??? undeclared (first use in this function)
> > 244 | fd = CHECK_MFD_NEW(TCID, MFD_DEF_SIZE, tc->flags);
> > | ^~~~
> > ---
> This one is used as a unique test identifier, we can hardcode something
> as "ltp_memfd_create01" there instead.
+1.
> > In file included from testcases/kernel/mem/include/mem.h:4,
> > from overcommit_memory.c:72:
> > overcommit_memory.c: In function ???setup???:
> > overcommit_memory.c:105:33: error: ???TCID??? undeclared (first use in this function)
> > 105 | "can't support to test %s", TCID);
> > | ^~~~
> > ---
> > In file included from ima_mmap.c:9:
> > ima_mmap.c: In function ???run???:
> > ima_mmap.c:36:43: error: ???TCID??? undeclared (first use in this function)
> > 36 | tst_brk(TBROK, "Usage: %s -f filename", TCID);
> > | ^~~~
> Hmm these two are using the TCID as a test binary name, which kind of
> works by accident. Because:
> 1. The library uses argv[0] to initialize TCID
> 2. Then TCID is used as a prefix for the temporary directory
> the test has created and also for filename on tmpfs
> There is no guarantee that TCID is equal to argv[0], it's only supposed
> to be unique identifier for a test.
> So I would rather be for removing TCID from these tests. The question is
> if we want to replace it with something that is guaranteed to contain
> the test binary name or remove it completely.
I'd be for just hardcoding the info in overcommit_memory.c as it's name from
kernel.
access(PATH_SYSVM "overcommit_ratio", F_OK) == -1)
- tst_brk(TCONF, "The system "
- "can't support to test %s", TCID);
+ tst_brk(TCONF, "The system can't support to test overcommit_memory");
But for IMA I'll just remove TCID:
testcases/kernel/security/integrity/ima/src/ima_mmap.c
if (!filename)
- tst_brk(TBROK, "Usage: %s -f filename", TCID);
+ tst_brk(TBROK, "missing filename (-f filename)");
Kind regards,
Petr
^ permalink raw reply [flat|nested] 14+ messages in thread
* [LTP] [RFC PATCH 2/8] controllers: Simplify fullpath definition
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 3/8] controllers: Fix linking with -fno-common Petr Vorel
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
PATH_MAX has been in <limits.h> in all libc for a long time.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/controllers/libcontrollers/libcontrollers.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index cdde9f9e6..f999f705e 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -42,11 +42,7 @@
#include <sys/types.h>
#include <unistd.h>
-#ifdef PATH_MAX
char fullpath[PATH_MAX];
-#else
-char fullpath[1024]; /* Guess */
-#endif
int FLAG;
volatile int timer_expired;
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 3/8] controllers: Fix linking with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 1/8] lib: Fix linking error multiple TCID definitions with -fno-common Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 2/8] controllers: Simplify fullpath definition Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 4/8] kernel/mem: Fix linking error " Petr Vorel
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
by moving definitions to libcontrollers.c and adding extern declarations
to libcontrollers.h.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
.../controllers/cpuctl/cpuctl_def_task01.c | 2 --
.../controllers/cpuctl/cpuctl_def_task02.c | 2 --
.../controllers/cpuctl/cpuctl_def_task03.c | 2 --
.../controllers/cpuctl/cpuctl_def_task04.c | 2 --
.../kernel/controllers/cpuctl/cpuctl_test01.c | 2 --
.../kernel/controllers/cpuctl/cpuctl_test02.c | 1 -
.../kernel/controllers/cpuctl/cpuctl_test03.c | 2 --
.../kernel/controllers/cpuctl/cpuctl_test04.c | 2 --
.../libcontrollers/libcontrollers.c | 11 ++++++++
.../libcontrollers/libcontrollers.h | 28 +++++++------------
10 files changed, 21 insertions(+), 33 deletions(-)
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 90119e4ad..578c60c89 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -81,8 +81,6 @@ extern void cleanup(void)
/* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index dc1546e88..658c6fd3f 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -76,8 +76,6 @@ extern void cleanup(void)
/* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index 92b451793..a700ca515 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -76,8 +76,6 @@ extern void cleanup(void)
/* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 108e576e1..1726f810d 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -76,8 +76,6 @@ extern void cleanup(void)
/* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index d7be1c80c..8f6d11de0 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -79,8 +79,6 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index 2a5cd4a11..52ad8aa2f 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -78,7 +78,6 @@ extern void cleanup(void)
}
int migrate_task();
-volatile int timer_expired = 0;
int main(void)
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index 8a80d6932..0e0a26dc3 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -76,8 +76,6 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index 791a58dd2..dae0d4c05 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -77,8 +77,6 @@ extern void cleanup(void)
tst_exit(); /* Report exit status */
}
-volatile int timer_expired = 0;
-
int main(int argc, char *argv[])
{
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
index 75766fc19..e9917271c 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -35,6 +35,17 @@
#include "libcontrollers.h"
+char fullpath[PATH_MAX];
+int FLAG;
+volatile int timer_expired = 0;
+int retval;
+unsigned int num_line;
+unsigned int current_shares;
+unsigned int total_shares;
+unsigned int *shares_pointer;
+char target[LINE_MAX];
+struct dirent *dir_pointer;
+
/*
* Function: scan_shares_file()
* This function scans all the shares files under the mountpoint
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index f999f705e..7d7b8324b 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -42,24 +42,16 @@
#include <sys/types.h>
#include <unistd.h>
-char fullpath[PATH_MAX];
-
-int FLAG;
-volatile int timer_expired;
-
-int retval;
-
-unsigned int num_line;//??
-
-unsigned int current_shares;
-
-unsigned int total_shares;
-
-unsigned int *shares_pointer;//??
-
-char target[LINE_MAX];
-
-struct dirent *dir_pointer;
+extern char fullpath[PATH_MAX];
+extern int FLAG;
+extern volatile int timer_expired;
+extern int retval;
+extern unsigned int num_line;
+extern unsigned int current_shares;
+extern unsigned int total_shares;
+extern unsigned int *shares_pointer;
+extern char target[LINE_MAX];
+extern struct dirent *dir_pointer;
enum{
GET_SHARES =1,
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 4/8] kernel/mem: Fix linking error with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (2 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 3/8] controllers: Fix linking with -fno-common Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 5/8] hugepage: " Petr Vorel
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
Adding missing extern.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/mem/include/mem.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index a12c2231f..cce9c0497 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -37,7 +37,7 @@ static inline void clean_node(unsigned long *array)
#define MLOCK 2
#define KSM 3
-long overcommit;
+extern long overcommit;
void oom(int testcase, int lite, int retcode, int allow_sigkill);
void testoom(int mempolicy, int lite, int retcode, int allow_sigkill);
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 5/8] hugepage: Fix linking error with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (3 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 4/8] kernel/mem: Fix linking error " Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 6/8] hugetlb: " Petr Vorel
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
by moving definitions to tst_hugepage.c and adding extern declarations
to tst_hugepage.h.
Fixes: 156f91396 ("hugetlb: move nr_opt to tst_hugepage.h")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/tst_hugepage.h | 4 ++--
lib/tst_hugepage.c | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/tst_hugepage.h b/include/tst_hugepage.h
index 30e00a377..60c03c5c5 100644
--- a/include/tst_hugepage.h
+++ b/include/tst_hugepage.h
@@ -9,8 +9,8 @@
#define PATH_HUGEPAGES "/sys/kernel/mm/hugepages/"
#define PATH_NR_HPAGES "/proc/sys/vm/nr_hugepages"
-char *nr_opt; /* -s num Set the number of the been allocated hugepages */
-char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */
+extern char *nr_opt; /* -s num Set the number of the been allocated hugepages */
+extern char *Hopt; /* -H /.. Location of hugetlbfs, i.e. -H /var/hugetlbfs */
/*
* Try the best to request a specified number of huge pages from system,
diff --git a/lib/tst_hugepage.c b/lib/tst_hugepage.c
index 34fd27ede..52667a14e 100644
--- a/lib/tst_hugepage.c
+++ b/lib/tst_hugepage.c
@@ -9,6 +9,8 @@
#include "tst_hugepage.h"
unsigned long tst_hugepages;
+char *nr_opt;
+char *Hopt;
unsigned long tst_request_hugepages(unsigned long hpages)
{
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 6/8] hugetlb: Fix linking error with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (4 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 5/8] hugepage: " Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 7/8] realtime: " Petr Vorel
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
Adding missing extern.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/mem/hugetlb/lib/hugetlb.c | 2 ++
testcases/kernel/mem/hugetlb/lib/hugetlb.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index cd1b27eb3..4bb2d500e 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -39,6 +39,8 @@
#include <pwd.h>
#include "hugetlb.h"
+key_t shmkey;
+
/*
* getipckey() - generates and returns a message key used by the "get"
* calls to create an IPC resource.
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index 88890ebfb..f75109f3e 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -34,7 +34,7 @@
*/
#define MODE_MASK 0x01FF
-key_t shmkey; /* an IPC key generated by ftok() */
+extern key_t shmkey; /* an IPC key generated by ftok() */
int getipckey(void);
int getuserid(char *user);
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 7/8] realtime: Fix linking error with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (5 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 6/8] hugetlb: " Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:28 ` [LTP] [RFC PATCH 8/8] travis: Build " Petr Vorel
2020-04-15 9:39 ` [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Cyril Hrubis
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
by declaring iters_per_us as static and moving from header into
C source.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/realtime/include/librttest.h | 1 -
testcases/realtime/lib/librttest.c | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/realtime/include/librttest.h b/testcases/realtime/include/librttest.h
index c18236200..b829f4089 100644
--- a/testcases/realtime/include/librttest.h
+++ b/testcases/realtime/include/librttest.h
@@ -66,7 +66,6 @@ extern char *optarg;
#define _MAXTHREADS 256
#define CALIBRATE_LOOPS 100000
-unsigned long iters_per_us;
#define NS_PER_MS 1000000
#define NS_PER_US 1000
diff --git a/testcases/realtime/lib/librttest.c b/testcases/realtime/lib/librttest.c
index 36790581e..722d99d50 100644
--- a/testcases/realtime/lib/librttest.c
+++ b/testcases/realtime/lib/librttest.c
@@ -63,6 +63,7 @@
static LIST_HEAD(_threads);
static atomic_t _thread_count = { -1 };
+static unsigned long iters_per_us;
pthread_mutex_t _buffer_mutex;
char *_print_buffer = NULL;
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 8/8] travis: Build with -fno-common
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (6 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 7/8] realtime: " Petr Vorel
@ 2020-04-15 9:28 ` Petr Vorel
2020-04-15 9:39 ` [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Cyril Hrubis
8 siblings, 0 replies; 14+ messages in thread
From: Petr Vorel @ 2020-04-15 9:28 UTC (permalink / raw)
To: ltp
This is the default with gcc-10, but use it with all compilers.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.sh b/build.sh
index e3d268c83..50fb527e4 100755
--- a/build.sh
+++ b/build.sh
@@ -9,7 +9,7 @@
set -e
-CFLAGS="${CFLAGS:--Werror=implicit-function-declaration}"
+CFLAGS="${CFLAGS:--Werror=implicit-function-declaration -fno-common}"
CC="${CC:-gcc}"
DEFAULT_PREFIX="$HOME/ltp-install"
--
2.26.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10)
2020-04-15 9:28 [LTP] [RFC PATCH 0/8] Fix compilation with -fno-common (gcc-10) Petr Vorel
` (7 preceding siblings ...)
2020-04-15 9:28 ` [LTP] [RFC PATCH 8/8] travis: Build " Petr Vorel
@ 2020-04-15 9:39 ` Cyril Hrubis
8 siblings, 0 replies; 14+ messages in thread
From: Cyril Hrubis @ 2020-04-15 9:39 UTC (permalink / raw)
To: ltp
Hi!
Looks good and pretty much straightforward.
--
chrubis@suse.cz
^ permalink raw reply [flat|nested] 14+ messages in thread