PR gold/12980
[deliverable/binutils-gdb.git] / gold / testsuite / protected_1.cc
index 9183312489a6ab2413a7fa8db04c3f097501abb5..049bda74c877e1e35d03937d44c21aed644ece7c 100644 (file)
@@ -31,3 +31,28 @@ f1()
 {
   return 1;
 }
+
+// The function f2 is used to test that the executable can see the
+// same function address for a protected function in the executable
+// and in the shared library.  We can't use the visibility attribute
+// here, becaues that may cause gcc to generate a PC relative reloc;
+// we need it to get the value from the GOT.  I'm not sure this is
+// really useful, given that it doesn't work with the visibility
+// attribute.  This test exists here mainly because the glibc
+// testsuite has the same test, and we want to make sure that gold
+// passes the glibc testsuite.
+
+extern "C" int f2();
+asm(".protected f2");
+
+extern "C" int
+f2()
+{
+  return 2;
+}
+
+int
+(*get_f2_addr())()
+{
+  return f2;
+}
This page took 0.035605 seconds and 4 git commands to generate.