propagate from branch 'com.redhat.elfutils.pmachata.threads' (head 8bd3bc10eb015c96f7bafcc6a22c973620b57dd8)
            to branch 'com.redhat.elfutils' (head c5a11b6b3329382f1b5ffd0020f0d93c64176f20)
diff --git a/libelf/gelf_getshdr.c b/libelf/gelf_getshdr.c
index 7f01a8f..f5457a7 100644
--- a/libelf/gelf_getshdr.c
+++ b/libelf/gelf_getshdr.c
@@ -74,12 +74,13 @@
       return NULL;
     }
 
-  rwlock_rdlock (scn->elf->lock);
+  RWLOCK_RDLOCK (scn->elf->lock);
 
   if (scn->elf->class == ELFCLASS32)
     {
       /* Copy the elements one-by-one.  */
-      Elf32_Shdr *shdr = scn->shdr.e32 ?: INTUSE(elf32_getshdr) (scn);
+      Elf32_Shdr *shdr
+	= scn->shdr.e32 ?: __elf32_getshdr_internal (scn, LS_RDLOCKED);
 
       if (shdr == NULL)
 	{
@@ -104,7 +105,8 @@
     }
   else
     {
-      Elf64_Shdr *shdr = scn->shdr.e64 ?: INTUSE(elf64_getshdr) (scn);
+      Elf64_Shdr *shdr
+	= scn->shdr.e64 ?: __elf64_getshdr_internal (scn, LS_RDLOCKED);
 
       if (shdr == NULL)
 	{
@@ -117,7 +119,7 @@
     }
 
  out:
-  rwlock_unlock (scn->elf->lock);
+  RWLOCK_UNLOCK (scn->elf->lock);
 
   return result;
 }