aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Strömbäck <filip.stromback@liu.se>2020-05-26 16:57:05 +0200
committerFilip Strömbäck <filip.stromback@liu.se>2020-05-26 16:59:17 +0200
commitb51fd37426d5c381f52bf93c5950479a9a13a594 (patch)
treebbe5b81ea76c655eeda431199fe2c410cd1d6be7
parent8434d9cf5bd082d5d7008ab66c282b6f67d9855d (diff)
downloadpintos-rs-b51fd37426d5c381f52bf93c5950479a9a13a594.tar.gz
Fixed compilation error on GCC 10.
GCC 10 uses -fno-common by default, which makes multiple definitions of the same symbol in multiple object files an error. This was used in the userspace test library, and broke with GCC10. Therefore, the relevant symbol is now marked as "weak" to solve the issue and to clarify the intent. Signed-off-by: Filip Strömbäck <filip.stromback@liu.se>
-rw-r--r--src/tests/lib.c2
-rw-r--r--src/tests/userprog/no-vm/multi-oom.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/tests/lib.c b/src/tests/lib.c
index ee36505..5e34069 100644
--- a/src/tests/lib.c
+++ b/src/tests/lib.c
@@ -5,6 +5,8 @@
#include <string.h>
#include <syscall.h>
+// Note: test_name is overridden in some tests, and not in others.
+__attribute__((weak))
const char *test_name;
bool quiet = false;
diff --git a/src/tests/userprog/no-vm/multi-oom.c b/src/tests/userprog/no-vm/multi-oom.c
index 6a4472d..bd09269 100644
--- a/src/tests/userprog/no-vm/multi-oom.c
+++ b/src/tests/userprog/no-vm/multi-oom.c
@@ -73,6 +73,7 @@ consume_some_resources_and_die (int seed)
{
case 0:
*(int *) NULL = 42;
+ break;
case 1:
return *(int *) NULL;
@@ -82,6 +83,7 @@ consume_some_resources_and_die (int seed)
case 3:
*PHYS_BASE = 42;
+ break;
case 4:
open ((char *)PHYS_BASE);