#endif
foo_p foo_ptr = foo;
+
+/* Address-significant access to protected symbols is not supported in
+ position-dependent mode on several architectures because GCC
+ generates relocations that assume that the address is local to the
+ main program. */
+#ifdef __PIE__
foo_p foo_procted_ptr = foo_protected;
+#endif
extern foo_p get_foo_p (void);
extern foo_p get_foo_hidden_p (void);
if ((*foo_ptr) () != -1)
abort ();
+#ifdef __PIE__
if (foo_procted_ptr != foo_protected)
abort ();
+#endif
if (foo_protected () != 0)
abort ();
+#ifdef __PIE__
if ((*foo_procted_ptr) () != 0)
abort ();
+#endif
p = get_foo_p ();
if (p != foo)
abort ();
p = get_foo_protected_p ();
+#ifdef __PIE__
if (p != foo_protected)
abort ();
+#endif
if (ret_foo_protected != 0 || (*p) () != ret_foo_protected)
abort ();
return foo;
}
+
+/* Address-significant access to protected symbols is not supported in
+ position-dependent mode on several architectures because GCC
+ generates relocations that assume that the address is local to the
+ main program. */
+#ifdef __PIE__
foo_p
__attribute__ ((noinline))
get_foo_protected (void)
{
return foo_protected;
}
+#endif
int
main (void)
if ((*p) () != -1)
abort ();
+#ifdef __PIE__
p = get_foo_protected ();
if ((*p) () != 0)
abort ();
+#endif
return 0;
}