]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: vdsosyms should not fail for architectures that don't have a vdso.
authorMark Wielaard <mjw@redhat.com>
Fri, 19 Dec 2014 17:54:04 +0000 (18:54 +0100)
committerMark Wielaard <mjw@redhat.com>
Fri, 19 Dec 2014 17:54:04 +0000 (18:54 +0100)
Not finding a vdso is not fatal. But there should be no errors trying.
And if the vdso is found, then getting the symbol table shouldn't fail.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
tests/ChangeLog
tests/vdsosyms.c

index 89336dab58d670ab0d4fb3a718224f4e630b4948..94058fd68c693a35283501f16b1b4e26855d0b4a 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-19  Mark Wielaard  <mjw@redhat.com>
+
+       * vdsosyms.c (vdso_seen): Removed.
+       (vdso_syms): New global.
+       (module_callback): Set and check vdso_syms.
+       (main): Return value depends on vdso_syms.
+
 2014-12-19  Mark Wielaard  <mjw@redhat.com>
 
        * backtrace-subr.sh (check_native_unsupported): Relax special ARM
index d04f36a1047f3adba735254fc9dcd331502fa4b4..c1f8d89fc0acd85c064c421a1a2c25acb83fb38e 100644 (file)
@@ -34,7 +34,7 @@ main (int argc __attribute__ ((unused)), char **argv)
   return 77;
 }
 #else /* __linux__ */
-static bool vdso_seen = false;
+static int vdso_syms = 0;
 
 static int
 module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)),
@@ -42,15 +42,15 @@ module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)),
                 void *arg __attribute__((unused)))
 {
   /* We can only recognize the vdso by inspecting the "magic name".  */
+  printf ("module name: %s\n", name);
   if (strncmp ("[vdso: ", name, 7) == 0)
     {
-      int syms = dwfl_module_getsymtab (mod);
-      printf ("vdso syms: %d\n", syms);
-      if (syms < 0)
+      vdso_syms = dwfl_module_getsymtab (mod);
+      printf ("vdso syms: %d\n", vdso_syms);
+      if (vdso_syms < 0)
        error (2, 0, "dwfl_module_getsymtab: %s", dwfl_errmsg (-1));
-      vdso_seen = true;
 
-      for (int i = 0; i < syms; i++)
+      for (int i = 0; i < vdso_syms; i++)
        {
          GElf_Sym sym;
          GElf_Addr addr;
@@ -102,7 +102,8 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
   if (dwfl_getmodules (dwfl, module_callback, NULL, 0) != 0)
     error (1, 0, "dwfl_getmodules: %s", dwfl_errmsg (-1));
 
-  return vdso_seen ? 0 : -1;
+  /* No symbols is ok, then we haven't seen the vdso at all on this arch.  */
+  return vdso_syms >= 0 ? 0 : -1;
 }
 
 #endif /* ! __linux__ */