about summary refs log tree commit diff
path: root/sysdeps/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mips')
-rw-r--r--sysdeps/mips/Makefile7
-rw-r--r--sysdeps/mips/tst-undefined-weak-lib.S43
-rw-r--r--sysdeps/mips/tst-undefined-weak.c28
3 files changed, 78 insertions, 0 deletions
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
index 7ac6fa5031..6ad69e9ef9 100644
--- a/sysdeps/mips/Makefile
+++ b/sysdeps/mips/Makefile
@@ -82,3 +82,10 @@ $(objpfx)tst-mode-switch-2: $(shared-thread-library)
 endif
 endif
 endif
+
+ifeq ($(subdir),elf)
+tests += tst-undefined-weak
+modules-names += tst-undefined-weak-lib
+
+$(objpfx)tst-undefined-weak: $(objpfx)tst-undefined-weak-lib.so
+endif
diff --git a/sysdeps/mips/tst-undefined-weak-lib.S b/sysdeps/mips/tst-undefined-weak-lib.S
new file mode 100644
index 0000000000..a175ebf90e
--- /dev/null
+++ b/sysdeps/mips/tst-undefined-weak-lib.S
@@ -0,0 +1,43 @@
+/* Undefined weak symbol loading shared module.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sgidefs.h>
+
+    .text
+    .globl	x
+    .set	nomips16
+    .set	nomicromips
+    .ent	x
+    .type	x, @function
+x:
+    .set noreorder
+#if _MIPS_SIM == _ABIO32
+    .cpload  $25
+    jr  $31
+    lb  $2,%got(a)($28)
+#else
+    .cpsetup  $25,$24,x
+    lb  $2,%got_disp(a)($28)
+    jr  $31
+    .cpreturn
+#endif
+    .set reorder
+    .end	x
+    .size	x, .-x
+    .weak	a
+    .hidden	a
diff --git a/sysdeps/mips/tst-undefined-weak.c b/sysdeps/mips/tst-undefined-weak.c
new file mode 100644
index 0000000000..1231da6912
--- /dev/null
+++ b/sysdeps/mips/tst-undefined-weak.c
@@ -0,0 +1,28 @@
+/* Undefined weak symbol loading main executable.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+int *x (void);
+
+int
+do_test (void)
+{
+  x ();
+  return 0;
+}
+
+#include <support/test-driver.c>