[RFC,03/11] elf: define note section for LibOS
diff mbox series

Message ID dfd71718cf139bb3f3c4a55c55f0776207cbb2ea.1568219399.git.isaku.yamahata@gmail.com
State New
Headers show
Series
  • Library OS support
Related show

Commit Message

Isaku Yamahata Sept. 11, 2019, 9:04 p.m. UTC
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

Patch
diff mbox series

diff --git a/elf/Makefile b/elf/Makefile
index d470e41402..275105b0de 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -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
diff --git a/elf/Versions b/elf/Versions
index 3b09901f6c..b9b4ae168a 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -78,5 +78,8 @@  ld {
 
     # Set value of a tunable.
     __tunable_get_val;
+
+    # libos
+    __libos_release; __libos_version; __libos_abi;
   }
 }
diff --git a/elf/libos.c b/elf/libos.c
new file mode 100644
index 0000000000..8fe3df4944
--- /dev/null
+++ b/elf/libos.c
@@ -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");