ifeq (${IS_64_BIT}, 1)
   ifndef NO_PERF_READ_VDSO32
     $(call feature_check,compile-32)
-    ifneq ($(feature-compile-32), 1)
+    ifeq ($(feature-compile-32), 1)
+      CFLAGS += -DHAVE_PERF_READ_VDSO32
+    else
       NO_PERF_READ_VDSO32 := 1
     endif
   endif
   endif
   ifndef NO_PERF_READ_VDSOX32
     $(call feature_check,compile-x32)
-    ifneq ($(feature-compile-x32), 1)
+    ifeq ($(feature-compile-x32), 1)
+      CFLAGS += -DHAVE_PERF_READ_VDSOX32
+    else
       NO_PERF_READ_VDSOX32 := 1
     endif
   endif
 
        enum dso_type dso_type;
 
        dso_type = machine__thread_dso_type(machine, thread);
+
+#ifndef HAVE_PERF_READ_VDSO32
+       if (dso_type == DSO__TYPE_32BIT)
+               return 0;
+#endif
+#ifndef HAVE_PERF_READ_VDSOX32
+       if (dso_type == DSO__TYPE_X32BIT)
+               return 0;
+#endif
+
        switch (dso_type) {
        case DSO__TYPE_32BIT:
                *dso = vdso__findnew_compat(machine, &vdso_info->vdso32);