[RFC,03/11] elf: define note section for LibOS
Commit Message
Define note section for LibOS which describes glibc release/version
and abi for LibOS.
LibOS can easily check it when loading ld.so.
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
---
elf/Makefile | 3 ++-
elf/Versions | 3 +++
elf/libos.c | 26 ++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 elf/libos.c
@@ -33,7 +33,8 @@ dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \
runtime init fini debug misc \
version profile tls origin scope \
execstack open close trampoline \
- exception sort-maps)
+ exception sort-maps) \
+ libos
ifeq (yes,$(use-ldconfig))
dl-routines += dl-cache
endif
@@ -78,5 +78,8 @@ ld {
# Set value of a tunable.
__tunable_get_val;
+
+ # libos
+ __libos_release; __libos_version; __libos_abi;
}
}
new file mode 100644
@@ -0,0 +1,26 @@
+/* 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 <libos.h>
+#include "../version.h"
+
+const char * __libos_release = RELEASE;
+const char * __libos_version = VERSION;
+const uint64_t __libos_abi = 0;
+LIBOS_NOTES("versions", LIBOS_NOTE_VERSION, __libos_release, __WORDSIZE / 8, "release");
+LIBOS_NOTES("versions", LIBOS_NOTE_VERSION, __libos_version, __WORDSIZE / 8, "version");
+LIBOS_NOTES("versions", LIBOS_NOTE_VERSION, __libos_abi, 8, "abi");