|
|
b1dca6 |
commit edd8d70b91e1ccef549a7c668499596cc4d56ad1
|
|
|
b1dca6 |
Author: Mihailo Stojanovic <mihailo.stojanovic@rt-rk.com>
|
|
|
b1dca6 |
Date: Fri Aug 23 16:47:27 2019 +0000
|
|
|
b1dca6 |
|
|
|
b1dca6 |
[MIPS] Raise highest supported EI_ABIVERSION value [BZ #24916]
|
|
|
b1dca6 |
|
|
|
b1dca6 |
This bumps the highest valid EI_ABIVERSION value to ABSOLUTE ABI.
|
|
|
b1dca6 |
|
|
|
b1dca6 |
New testcase loads the symbol from the GOT with the "lb" instruction
|
|
|
b1dca6 |
so that the EI_ABIVERSION header field of the shared object is set
|
|
|
b1dca6 |
to ABSOLUTE (it doesn't actually check the value of the symbol), and
|
|
|
b1dca6 |
makes sure that the main executable is executed without "ABI version
|
|
|
b1dca6 |
invalid" error.
|
|
|
b1dca6 |
|
|
|
b1dca6 |
Tested for all three ABIs (o32, n32, n64) using both static linker which
|
|
|
b1dca6 |
handles undefined weak symbols correctly [1] (and sets the EI_ABIVERSION
|
|
|
b1dca6 |
of the test module) and the one that doesn't (EI_ABIVERSION left as 0).
|
|
|
b1dca6 |
|
|
|
b1dca6 |
[1] https://sourceware.org/ml/binutils/2018-07/msg00268.html
|
|
|
b1dca6 |
|
|
|
b1dca6 |
[BZ #24916]
|
|
|
b1dca6 |
* sysdeps/mips/Makefile [$(subdir) = elf] (tests): Add
|
|
|
b1dca6 |
tst-undefined-weak.
|
|
|
b1dca6 |
[$(subdir) = elf] (modules-names): Add tst-undefined-weak-lib.
|
|
|
b1dca6 |
[$(subdir) = elf] ($(objpfx)tst-undefined-weak): Add dependency.
|
|
|
b1dca6 |
* sysdeps/mips/tst-undefined-weak-lib.S: New file.
|
|
|
b1dca6 |
* sysdeps/mips/tst-undefined-weak.c: Likewise.
|
|
|
b1dca6 |
* sysdeps/unix/sysv/linux/mips/ldsodefs.h (VALID_ELF_ABIVERSION):
|
|
|
b1dca6 |
Increment highest valid ABIVERSION value.
|
|
|
b1dca6 |
|
|
|
b1dca6 |
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
|
|
|
b1dca6 |
index 7ac6fa50311d60b7..6ad69e9ef9e88728 100644
|
|
|
b1dca6 |
--- a/sysdeps/mips/Makefile
|
|
|
b1dca6 |
+++ b/sysdeps/mips/Makefile
|
|
|
b1dca6 |
@@ -82,3 +82,10 @@ $(objpfx)tst-mode-switch-2: $(shared-thread-library)
|
|
|
b1dca6 |
endif
|
|
|
b1dca6 |
endif
|
|
|
b1dca6 |
endif
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ifeq ($(subdir),elf)
|
|
|
b1dca6 |
+tests += tst-undefined-weak
|
|
|
b1dca6 |
+modules-names += tst-undefined-weak-lib
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+$(objpfx)tst-undefined-weak: $(objpfx)tst-undefined-weak-lib.so
|
|
|
b1dca6 |
+endif
|
|
|
b1dca6 |
diff --git a/sysdeps/mips/tst-undefined-weak-lib.S b/sysdeps/mips/tst-undefined-weak-lib.S
|
|
|
b1dca6 |
new file mode 100644
|
|
|
b1dca6 |
index 0000000000000000..a175ebf90e01b372
|
|
|
b1dca6 |
--- /dev/null
|
|
|
b1dca6 |
+++ b/sysdeps/mips/tst-undefined-weak-lib.S
|
|
|
b1dca6 |
@@ -0,0 +1,43 @@
|
|
|
b1dca6 |
+/* Undefined weak symbol loading shared module.
|
|
|
b1dca6 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
b1dca6 |
+ This file is part of the GNU C Library.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
b1dca6 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License as published by the Free Software Foundation; either
|
|
|
b1dca6 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
b1dca6 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
b1dca6 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
b1dca6 |
+ Lesser General Public License for more details.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License along with the GNU C Library; if not, see
|
|
|
b1dca6 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+#include <sgidefs.h>
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ .text
|
|
|
b1dca6 |
+ .globl x
|
|
|
b1dca6 |
+ .set nomips16
|
|
|
b1dca6 |
+ .set nomicromips
|
|
|
b1dca6 |
+ .ent x
|
|
|
b1dca6 |
+ .type x, @function
|
|
|
b1dca6 |
+x:
|
|
|
b1dca6 |
+ .set noreorder
|
|
|
b1dca6 |
+#if _MIPS_SIM == _ABIO32
|
|
|
b1dca6 |
+ .cpload $25
|
|
|
b1dca6 |
+ jr $31
|
|
|
b1dca6 |
+ lb $2,%got(a)($28)
|
|
|
b1dca6 |
+#else
|
|
|
b1dca6 |
+ .cpsetup $25,$24,x
|
|
|
b1dca6 |
+ lb $2,%got_disp(a)($28)
|
|
|
b1dca6 |
+ jr $31
|
|
|
b1dca6 |
+ .cpreturn
|
|
|
b1dca6 |
+#endif
|
|
|
b1dca6 |
+ .set reorder
|
|
|
b1dca6 |
+ .end x
|
|
|
b1dca6 |
+ .size x, .-x
|
|
|
b1dca6 |
+ .weak a
|
|
|
b1dca6 |
+ .hidden a
|
|
|
b1dca6 |
diff --git a/sysdeps/mips/tst-undefined-weak.c b/sysdeps/mips/tst-undefined-weak.c
|
|
|
b1dca6 |
new file mode 100644
|
|
|
b1dca6 |
index 0000000000000000..1231da6912508c19
|
|
|
b1dca6 |
--- /dev/null
|
|
|
b1dca6 |
+++ b/sysdeps/mips/tst-undefined-weak.c
|
|
|
b1dca6 |
@@ -0,0 +1,28 @@
|
|
|
b1dca6 |
+/* Undefined weak symbol loading main executable.
|
|
|
b1dca6 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
b1dca6 |
+ This file is part of the GNU C Library.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
b1dca6 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License as published by the Free Software Foundation; either
|
|
|
b1dca6 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
b1dca6 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
b1dca6 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
b1dca6 |
+ Lesser General Public License for more details.
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
b1dca6 |
+ License along with the GNU C Library; if not, see
|
|
|
b1dca6 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+int *x (void);
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+int
|
|
|
b1dca6 |
+do_test (void)
|
|
|
b1dca6 |
+{
|
|
|
b1dca6 |
+ x ();
|
|
|
b1dca6 |
+ return 0;
|
|
|
b1dca6 |
+}
|
|
|
b1dca6 |
+
|
|
|
b1dca6 |
+#include <support/test-driver.c>
|
|
|
b1dca6 |
diff --git a/sysdeps/unix/sysv/linux/mips/ldsodefs.h b/sysdeps/unix/sysv/linux/mips/ldsodefs.h
|
|
|
b1dca6 |
index 68a0a99bb1f1ec85..d2912cadabfd6877 100644
|
|
|
b1dca6 |
--- a/sysdeps/unix/sysv/linux/mips/ldsodefs.h
|
|
|
b1dca6 |
+++ b/sysdeps/unix/sysv/linux/mips/ldsodefs.h
|
|
|
b1dca6 |
@@ -34,7 +34,7 @@ extern void _dl_static_init (struct link_map *map);
|
|
|
b1dca6 |
#undef VALID_ELF_ABIVERSION
|
|
|
b1dca6 |
#define VALID_ELF_ABIVERSION(osabi,ver) \
|
|
|
b1dca6 |
(ver == 0 \
|
|
|
b1dca6 |
- || (osabi == ELFOSABI_SYSV && ver < 4) \
|
|
|
b1dca6 |
+ || (osabi == ELFOSABI_SYSV && ver < 5) \
|
|
|
b1dca6 |
|| (osabi == ELFOSABI_GNU && ver < LIBC_ABI_MAX))
|
|
|
b1dca6 |
|
|
|
b1dca6 |
#endif /* ldsodefs.h */
|