summaryrefslogtreecommitdiffstats
path: root/libelf/elf_version.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2020-06-09 18:21:36 +0200
committerMark Wielaard <[email protected]>2020-06-09 18:21:36 +0200
commitc0d643e7d91fc002c9fecd83277c62a0e56ef76f (patch)
tree89b5cf6673baa2cb206fdf245f4e30fe884945ad /libelf/elf_version.c
parent14030673602a4f331f348decd51e5f0160719f0e (diff)
parent5643e037cb7a38ed5d52f50421be706ea8014e3d (diff)
Merge tag 'elfutils-0.177' into mjw/RH-DTSdts-0.177
elfutils 0.177 release Conflicts: libebl/eblopenbackend.c Removed try_dlopen and csky. tests/run-strip-reloc.sh Removed csky tests.
Diffstat (limited to 'libelf/elf_version.c')
-rw-r--r--libelf/elf_version.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/libelf/elf_version.c b/libelf/elf_version.c
index 7c336ff9..6ec534ab 100644
--- a/libelf/elf_version.c
+++ b/libelf/elf_version.c
@@ -34,32 +34,25 @@
#include <libelfP.h>
-/* Is the version initialized? */
-int __libelf_version_initialized;
-
-/* Currently selected version. */
-unsigned int __libelf_version = EV_CURRENT;
-
+/* Currently selected version. Should be EV_CURRENT.
+ Will be EV_NONE if elf_version () has not been called yet. */
+unsigned int __libelf_version = EV_NONE;
unsigned int
elf_version (unsigned int version)
{
if (version == EV_NONE)
- return __libelf_version;
+ return EV_CURRENT;
- if (likely (version < EV_NUM))
+ if (likely (version == EV_CURRENT))
{
/* Phew, we know this version. */
- unsigned int last_version = __libelf_version;
-
- /* Store the new version. */
- __libelf_version = version;
/* Signal that the version is now initialized. */
- __libelf_version_initialized = 1;
+ __libelf_version = EV_CURRENT;
- /* And return the last version. */
- return last_version;
+ /* And return the last (or initial) version. */
+ return EV_CURRENT;
}
/* We cannot handle this version. */