1b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper/* Return string pointer from string section.
2058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9Mark Wielaard   Copyright (C) 1998-2002, 2004, 2008, 2009, 2015 Red Hat, Inc.
3de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   This file is part of elfutils.
4b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper   Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
5b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
6de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   This file is free software; you can redistribute it and/or modify
7de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   it under the terms of either
8b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
9de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard     * the GNU Lesser General Public License as published by the Free
10de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard       Software Foundation; either version 3 of the License, or (at
11de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard       your option) any later version
12de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard
13de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   or
14de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard
15de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard     * the GNU General Public License as published by the Free
16de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard       Software Foundation; either version 2 of the License, or (at
17de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard       your option) any later version
18de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard
19de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   or both in parallel, as here.
20de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard
21de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   elfutils is distributed in the hope that it will be useful, but
22361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper   WITHOUT ANY WARRANTY; without even the implied warranty of
23361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24361df7da6dfecd817b27e62b91752ac316d7cdd4Ulrich Drepper   General Public License for more details.
25b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
26de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   You should have received copies of the GNU General Public License and
27de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   the GNU Lesser General Public License along with this program.  If
28de2ed97f33139af5c7a0811e4ec66fc896a13cf2Mark Wielaard   not, see <http://www.gnu.org/licenses/>.  */
29b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
30b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper#ifdef HAVE_CONFIG_H
31b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper# include <config.h>
32b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper#endif
33b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
34b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper#include <libelf.h>
35b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper#include <stddef.h>
36b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
37b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper#include "libelfP.h"
38b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
39b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
40203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsiehstatic void *
41203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsiehget_zdata (Elf_Scn *strscn)
42203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh{
43203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  size_t zsize, zalign;
44203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  void *zdata = __libelf_decompress_elf (strscn, &zsize, &zalign);
45203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  if (zdata == NULL)
46203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh    return NULL;
47203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh
48203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  strscn->zdata_base = zdata;
49203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  strscn->zdata_size = zsize;
50203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  strscn->zdata_align = zalign;
51203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh
52203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh  return zdata;
53203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh}
54203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh
55b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepperchar *
561ccdfb683ad6c7e59793136c3a657ddf131cafd1Mark Wielaardelf_strptr (Elf *elf, size_t idx, size_t offset)
57b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper{
58b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  if (elf == NULL)
59b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    return NULL;
60b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
61b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  if (elf->kind != ELF_K_ELF)
62b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    {
63b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      __libelf_seterrno (ELF_E_INVALID_HANDLE);
64b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      return NULL;
65b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    }
66b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
67b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath  rwlock_rdlock (elf->lock);
68b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
69b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  char *result = NULL;
70b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  Elf_Scn *strscn;
71b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
72b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  /* Find the section in the list.  */
73b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  Elf_ScnList *runp = (elf->class == ELFCLASS32
74b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper		       || (offsetof (struct Elf, state.elf32.scns)
75b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper			   == offsetof (struct Elf, state.elf64.scns))
76b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper		       ? &elf->state.elf32.scns : &elf->state.elf64.scns);
77b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  while (1)
78b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    {
79b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      if (idx < runp->max)
80b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
81b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  if (idx < runp->cnt)
82b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	    strscn = &runp->data[idx];
83b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  else
84b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	    {
85b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	      __libelf_seterrno (ELF_E_INVALID_INDEX);
86b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	      goto out;
87b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	    }
88b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  break;
89b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
90b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
91b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      idx -= runp->max;
92b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
93b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      runp = runp->next;
94b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper      if (runp == NULL)
95b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
96b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  __libelf_seterrno (ELF_E_INVALID_INDEX);
97b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  goto out;
98b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
99b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    }
100b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
1019d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard  size_t sh_size = 0;
102b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  if (elf->class == ELFCLASS32)
103b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    {
104058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9Mark Wielaard      Elf32_Shdr *shdr = strscn->shdr.e32 ?: __elf32_getshdr_rdlock (strscn);
105058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9Mark Wielaard      if (unlikely (shdr->sh_type != SHT_STRTAB))
106b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
107b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  /* This is no string section.  */
108b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  __libelf_seterrno (ELF_E_INVALID_SECTION);
109b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  goto out;
110b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
111b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
112519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      if ((shdr->sh_flags & SHF_COMPRESSED) == 0)
113519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	sh_size = shdr->sh_size;
114519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      else
115519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	{
116203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh	  if (strscn->zdata_base == NULL && get_zdata (strscn) == NULL)
117519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	    goto out;
118519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	  sh_size = strscn->zdata_size;
119519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	}
120519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard
121519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      if (unlikely (offset >= sh_size))
122b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
123b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  /* The given offset is too big, it is beyond this section.  */
124b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  __libelf_seterrno (ELF_E_OFFSET_RANGE);
125b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  goto out;
126b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
127b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    }
128b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  else
129b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    {
130058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9Mark Wielaard      Elf64_Shdr *shdr = strscn->shdr.e64 ?: __elf64_getshdr_rdlock (strscn);
131058ae7b4d5bdfa0f39312b056ee9cadc4c3ffeb9Mark Wielaard      if (unlikely (shdr->sh_type != SHT_STRTAB))
132b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
133b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  /* This is no string section.  */
134b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  __libelf_seterrno (ELF_E_INVALID_SECTION);
135b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  goto out;
136b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
137b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
138519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      if ((shdr->sh_flags & SHF_COMPRESSED) == 0)
139519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	sh_size = shdr->sh_size;
140519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      else
141519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	{
142203f0a3eec8c630c5183fb9984d66339c1ea3c31Chih-Hung Hsieh	  if (strscn->zdata_base == NULL && get_zdata (strscn) == NULL)
143519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	    goto out;
144519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	  sh_size = strscn->zdata_size;
145519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard	}
146519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard
147519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      if (unlikely (offset >= sh_size))
148b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	{
149b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  /* The given offset is too big, it is beyond this section.  */
150b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  __libelf_seterrno (ELF_E_OFFSET_RANGE);
151b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	  goto out;
152b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper	}
153b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper    }
154b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
155b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath  if (strscn->rawdata_base == NULL && ! strscn->data_read)
156b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath    {
157b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath      rwlock_unlock (elf->lock);
158b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath      rwlock_wrlock (elf->lock);
159b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath      if (strscn->rawdata_base == NULL && ! strscn->data_read
160b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath	/* Read the section data.  */
161b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath	  && __libelf_set_rawdata_wrlock (strscn) != 0)
162b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath	goto out;
163b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath    }
164b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
165519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard  if (unlikely (strscn->zdata_base != NULL))
166519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard    {
167519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      /* Make sure the string is NUL terminated.  Start from the end,
168519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard         which very likely is a NUL char.  */
169519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      if (likely (memrchr (&strscn->zdata_base[offset],
170519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard			   '\0', sh_size - offset) != NULL))
171519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard        result = &strscn->zdata_base[offset];
172519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard      else
173519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard        __libelf_seterrno (ELF_E_INVALID_INDEX);
174519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard    }
175519c13c9c7fc591609eed405a3e952707c60ec7eMark Wielaard  else if (likely (strscn->data_list_rear == NULL))
176710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard    {
177710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // XXX The above is currently correct since elf_newdata will
178710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // make sure to convert the rawdata into the datalist if
179710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // necessary. But it would be more efficient to keep the rawdata
180710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // unconverted and only then iterate over the rest of the (newly
181710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // added data) list.  Note that when the ELF file is mmapped
182710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // rawdata_base can be set while rawdata.d hasn't been
183710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // initialized yet (when data_read is zero). So we cannot just
184710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard      // look at the rawdata.d.d_size.
1859d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard
1869d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard      /* Make sure the string is NUL terminated.  Start from the end,
1879d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	 which very likely is a NUL char.  */
1889d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard      if (likely (memrchr (&strscn->rawdata_base[offset],
1899d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard			  '\0', sh_size - offset) != NULL))
1909d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	result = &strscn->rawdata_base[offset];
1919d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard      else
1929d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	__libelf_seterrno (ELF_E_INVALID_INDEX);
193710ca87893bef2fa186265a8624a6402509ba1f3Mark Wielaard    }
19489759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper  else
19589759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper    {
19689759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper      /* This is a file which is currently created.  Use the list of
19789759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	 data blocks.  */
19889759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper      struct Elf_Data_List *dl = &strscn->data_list;
19989759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper      while (dl != NULL)
20089759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	{
20189759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	  if (offset >= (size_t) dl->data.d.d_off
20289759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	      && offset < dl->data.d.d_off + dl->data.d.d_size)
20389759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	    {
2049d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	      /* Make sure the string is NUL terminated.  Start from
2059d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard		 the end, which very likely is a NUL char.  */
2069d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	      if (likely (memrchr ((char *) dl->data.d.d_buf
2079d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard				   + (offset - dl->data.d.d_off), '\0',
2089d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard				   (dl->data.d.d_size
2099d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard				    - (offset - dl->data.d.d_off))) != NULL))
2109d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard		result = ((char *) dl->data.d.d_buf
2119d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard			  + (offset - dl->data.d.d_off));
2129d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard	      else
2139d481b29e773f01781f70f1bcdfc05dd66c796eaMark Wielaard		__libelf_seterrno (ELF_E_INVALID_INDEX);
21489759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	      break;
21589759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	    }
21689759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper
21789759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	  dl = dl->next;
21889759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper	}
21989759c76ee1e3231ee89d4aafed3a88772ce2245Ulrich Drepper    }
220b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
221b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper out:
222b4d6f0f8064f2b706ea9035ef0393d8299671390Roland McGrath  rwlock_unlock (elf->lock);
223b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper
224b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper  return result;
225b08d5a8fb42f4586d756068065186b5af7e48daUlrich Drepper}
226b08d5a8fb42f4586d756068065186b5af7e48daUlrich DrepperINTDEF(elf_strptr)
227