summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-08 10:20:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-07-24 07:12:58 +0200
commit6f94a830bd750bc744b3e605be52978d1cd006e3 (patch)
treee96b76472d6c4b4c47b497491f46c2d8b61cb802 /testsuites/sptests
parentspintrcritical_support: Remove (diff)
downloadrtems-6f94a830bd750bc744b3e605be52978d1cd006e3.tar.bz2
score: Add RTEMS_WEAK
Update #4032.
Diffstat (limited to 'testsuites/sptests')
-rw-r--r--testsuites/sptests/Makefile.am2
-rw-r--r--testsuites/sptests/spmisc01/init.c15
-rw-r--r--testsuites/sptests/spmisc01/spmisc01.h45
-rw-r--r--testsuites/sptests/spmisc01/strong.c47
4 files changed, 108 insertions, 1 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5404ba4302..854ec3daf8 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -1409,7 +1409,7 @@ if TEST_spmisc01
sp_tests += spmisc01
sp_screens += spmisc01/spmisc01.scn
sp_docs += spmisc01/spmisc01.doc
-spmisc01_SOURCES = spmisc01/init.c
+spmisc01_SOURCES = spmisc01/init.c spmisc01/strong.c
spmisc01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spmisc01) \
$(support_includes)
endif
diff --git a/testsuites/sptests/spmisc01/init.c b/testsuites/sptests/spmisc01/init.c
index 9090069973..e64fa4e480 100644
--- a/testsuites/sptests/spmisc01/init.c
+++ b/testsuites/sptests/spmisc01/init.c
@@ -21,6 +21,8 @@
#include <tmacros.h>
+#include "spmisc01.h"
+
const char rtems_test_name[] = "SPMISC 1";
RTEMS_INLINE_ROUTINE int inline_func(void)
@@ -70,6 +72,16 @@ static int alias_func(void) RTEMS_ALIAS(noinline_func);
int weak_alias_func(void) RTEMS_WEAK_ALIAS(noinline_func);
+RTEMS_WEAK int weak_or_strong(void)
+{
+ return 99;
+}
+
+RTEMS_WEAK int weak_2(void)
+{
+ return 111;
+}
+
static char aligned_variable RTEMS_ALIGNED(64);
typedef struct {
@@ -205,6 +217,9 @@ static void Init(rtems_task_argument arg)
rtems_test_assert(sizeof(packed_struct) == 5);
rtems_test_assert(alias_func() == 14);
rtems_test_assert(weak_alias_func() == 14);
+ pull_in_strong();
+ rtems_test_assert(weak_or_strong() == 77);
+ rtems_test_assert(weak_2() == 111);
rtems_test_assert(((uintptr_t) &aligned_variable) % 64 == 0);
rtems_test_assert(offsetof(aligned_member_struct, aligned_member) % 64 == 0);
unreachable();
diff --git a/testsuites/sptests/spmisc01/spmisc01.h b/testsuites/sptests/spmisc01/spmisc01.h
new file mode 100644
index 0000000000..6dbf9ca23c
--- /dev/null
+++ b/testsuites/sptests/spmisc01/spmisc01.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SPMISC01_H
+#define _SPMISC01_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int weak_or_strong(void);
+
+void pull_in_strong(void);
+
+int weak_2(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SPMISC01_H */
diff --git a/testsuites/sptests/spmisc01/strong.c b/testsuites/sptests/spmisc01/strong.c
new file mode 100644
index 0000000000..6341131b67
--- /dev/null
+++ b/testsuites/sptests/spmisc01/strong.c
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "spmisc01.h"
+
+int weak_or_strong(void)
+{
+ return 77;
+}
+
+void pull_in_strong(void)
+{
+ /* Do nothing */
+}
+
+RTEMS_WEAK int weak_2(void)
+{
+ return 222;
+}