elfinterp.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. /* vi: set sw=4 ts=4: */
  2. /* powerpc shared library loader suppport
  3. *
  4. * Copyright (C) 2001-2002 David A. Schleef
  5. * Copyright (C) 2003-2004 Erik Andersen
  6. * Copyright (C) 2004 Joakim Tjernlund
  7. *
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. The name of the above contributors may not be
  16. * used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. */
  31. #if defined (__SUPPORT_LD_DEBUG__)
  32. static const char *_dl_reltypes_tab[] =
  33. { "R_PPC_NONE", "R_PPC_ADDR32", "R_PPC_ADDR24", "R_PPC_ADDR16",
  34. "R_PPC_ADDR16_LO", "R_PPC_ADDR16_HI", "R_PPC_ADDR16_HA",
  35. "R_PPC_ADDR14", "R_PPC_ADDR14_BRTAKEN", "R_PPC_ADDR14_BRNTAKEN",
  36. "R_PPC_REL24", "R_PPC_REL14", "R_PPC_REL14_BRTAKEN",
  37. "R_PPC_REL14_BRNTAKEN", "R_PPC_GOT16", "R_PPC_GOT16_LO",
  38. "R_PPC_GOT16_HI", "R_PPC_GOT16_HA", "R_PPC_PLTREL24",
  39. "R_PPC_COPY", "R_PPC_GLOB_DAT", "R_PPC_JMP_SLOT", "R_PPC_RELATIVE",
  40. "R_PPC_LOCAL24PC", "R_PPC_UADDR32", "R_PPC_UADDR16", "R_PPC_REL32",
  41. "R_PPC_PLT32", "R_PPC_PLTREL32", "R_PPC_PLT16_LO", "R_PPC_PLT16_HI",
  42. "R_PPC_PLT16_HA", "R_PPC_SDAREL16", "R_PPC_SECTOFF",
  43. "R_PPC_SECTOFF_LO", "R_PPC_SECTOFF_HI", "R_PPC_SECTOFF_HA",
  44. };
  45. static const char *
  46. _dl_reltypes(int type)
  47. {
  48. static char buf[22];
  49. const char *str;
  50. if (type >= (int)(sizeof (_dl_reltypes_tab)/sizeof(_dl_reltypes_tab[0])) ||
  51. NULL == (str = _dl_reltypes_tab[type]))
  52. {
  53. str =_dl_simple_ltoa( buf, (unsigned long)(type));
  54. }
  55. return str;
  56. }
  57. static
  58. void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
  59. {
  60. if(_dl_debug_symbols)
  61. {
  62. if(symtab_index){
  63. _dl_dprintf(_dl_debug_file, "\n%s\n\tvalue=%x\tsize=%x\tinfo=%x\tother=%x\tshndx=%x",
  64. strtab + symtab[symtab_index].st_name,
  65. symtab[symtab_index].st_value,
  66. symtab[symtab_index].st_size,
  67. symtab[symtab_index].st_info,
  68. symtab[symtab_index].st_other,
  69. symtab[symtab_index].st_shndx);
  70. }
  71. }
  72. }
  73. static
  74. void debug_reloc(Elf32_Sym *symtab,char *strtab, ELF_RELOC *rpnt)
  75. {
  76. if(_dl_debug_reloc)
  77. {
  78. int symtab_index;
  79. const char *sym;
  80. symtab_index = ELF32_R_SYM(rpnt->r_info);
  81. sym = symtab_index ? strtab + symtab[symtab_index].st_name : "sym=0x0";
  82. if(_dl_debug_symbols)
  83. _dl_dprintf(_dl_debug_file, "\n\t");
  84. else
  85. _dl_dprintf(_dl_debug_file, "\n%s\n\t", sym);
  86. #ifdef ELF_USES_RELOCA
  87. _dl_dprintf(_dl_debug_file, "%s\toffset=%x\taddend=%x",
  88. _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
  89. rpnt->r_offset,
  90. rpnt->r_addend);
  91. #else
  92. _dl_dprintf(_dl_debug_file, "%s\toffset=%x\n",
  93. _dl_reltypes(ELF32_R_TYPE(rpnt->r_info)),
  94. rpnt->r_offset);
  95. #endif
  96. }
  97. }
  98. #endif
  99. extern int _dl_linux_resolve(void);
  100. void _dl_init_got(unsigned long *plt,struct elf_resolve *tpnt)
  101. {
  102. Elf32_Word *tramp;
  103. Elf32_Word num_plt_entries;
  104. Elf32_Word data_words;
  105. Elf32_Word rel_offset_words;
  106. Elf32_Word dlrr = (Elf32_Word) _dl_linux_resolve;
  107. num_plt_entries = tpnt->dynamic_info[DT_PLTRELSZ] / sizeof(ELF_RELOC);
  108. rel_offset_words = PLT_DATA_START_WORDS(num_plt_entries);
  109. data_words = (Elf32_Word) (plt + rel_offset_words);
  110. tpnt->data_words = data_words;
  111. plt[PLT_LONGBRANCH_ENTRY_WORDS] = OPCODE_ADDIS_HI(11, 11, data_words);
  112. plt[PLT_LONGBRANCH_ENTRY_WORDS+1] = OPCODE_LWZ(11,data_words,11);
  113. plt[PLT_LONGBRANCH_ENTRY_WORDS+2] = OPCODE_MTCTR(11);
  114. plt[PLT_LONGBRANCH_ENTRY_WORDS+3] = OPCODE_BCTR();
  115. /* [4] */
  116. /* [5] */
  117. tramp = (Elf32_Word *) (plt + PLT_TRAMPOLINE_ENTRY_WORDS);
  118. /* For the long entries, subtract off data_words. */
  119. tramp[0] = OPCODE_ADDIS_HI(11,11,-data_words);
  120. tramp[1] = OPCODE_ADDI(11,11,-data_words);
  121. /* Multiply index of entry by 3 (in r11). */
  122. tramp[2] = OPCODE_SLWI(12,11,1);
  123. tramp[3] = OPCODE_ADD(11,12,11);
  124. if (dlrr <= 0x01fffffc || dlrr >= 0xfe000000) {
  125. /* Load address of link map in r12. */
  126. tramp[4] = OPCODE_LI (12, (Elf32_Word) tpnt);
  127. tramp[5] = OPCODE_ADDIS_HI (12, 12, (Elf32_Word) tpnt);
  128. /* Call _dl_linux_resolve . */
  129. tramp[6] = OPCODE_BA (dlrr);
  130. } else {
  131. /* Get address of _dl_linux_resolve in CTR. */
  132. tramp[4] = OPCODE_LI(12,dlrr);
  133. tramp[5] = OPCODE_ADDIS_HI(12,12,dlrr);
  134. tramp[6] = OPCODE_MTCTR(12);
  135. /* Load address of link map in r12. */
  136. tramp[7] = OPCODE_LI(12,(Elf32_Word) tpnt);
  137. tramp[8] = OPCODE_ADDIS_HI(12,12,(Elf32_Word) tpnt);
  138. /* Call _dl_linux_resolve. */
  139. tramp[9] = OPCODE_BCTR();
  140. }
  141. /* [16] unused */
  142. /* [17] unused */
  143. PPC_DCBST(plt);
  144. PPC_DCBST(plt+4);
  145. PPC_DCBST(plt+8);
  146. PPC_DCBST(plt+12);
  147. PPC_DCBST(plt+16-1);
  148. PPC_SYNC;
  149. PPC_ICBI(plt);
  150. PPC_ICBI(plt+16-1);
  151. PPC_ISYNC;
  152. }
  153. unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
  154. {
  155. ELF_RELOC *this_reloc;
  156. char *strtab;
  157. Elf32_Sym *symtab;
  158. ELF_RELOC *rel_addr;
  159. int symtab_index;
  160. char *symname;
  161. Elf32_Addr *reloc_addr;
  162. Elf32_Addr finaladdr;
  163. Elf32_Sword delta;
  164. rel_addr = (ELF_RELOC *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr);
  165. this_reloc = (void *)rel_addr + reloc_entry;
  166. symtab_index = ELF32_R_SYM(this_reloc->r_info);
  167. symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
  168. strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
  169. symname = strtab + symtab[symtab_index].st_name;
  170. #if defined (__SUPPORT_LD_DEBUG__)
  171. debug_sym(symtab,strtab,symtab_index);
  172. debug_reloc(symtab,strtab,this_reloc);
  173. if (ELF32_R_TYPE(this_reloc->r_info) != R_PPC_JMP_SLOT) {
  174. _dl_dprintf(2, "%s: Incorrect relocation type in jump relocation\n", _dl_progname);
  175. _dl_exit(1);
  176. };
  177. #endif
  178. /* Address of dump instruction to fix up */
  179. reloc_addr = (Elf32_Addr *) (tpnt->loadaddr + this_reloc->r_offset);
  180. #if defined (__SUPPORT_LD_DEBUG__)
  181. if(_dl_debug_reloc && _dl_debug_detail)
  182. _dl_dprintf(_dl_debug_file, "\n\tResolving symbol %s %x --> ", symname, (Elf32_Addr)reloc_addr);
  183. #endif
  184. /* Get the address of the GOT entry */
  185. finaladdr = (Elf32_Addr) _dl_find_hash(symname,
  186. tpnt->symbol_scope, ELF_RTYPE_CLASS_PLT);
  187. if (!finaladdr) {
  188. _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
  189. _dl_exit(1);
  190. };
  191. #if defined (__SUPPORT_LD_DEBUG__)
  192. if(_dl_debug_reloc && _dl_debug_detail)
  193. _dl_dprintf(_dl_debug_file, "%x\n", finaladdr);
  194. #endif
  195. delta = finaladdr - (Elf32_Word)reloc_addr;
  196. if (delta<<6>>6 == delta) {
  197. *reloc_addr = OPCODE_B(delta);
  198. } else if (finaladdr <= 0x01fffffc) {
  199. *reloc_addr = OPCODE_BA (finaladdr);
  200. } else {
  201. /* Warning: we don't handle double-sized PLT entries */
  202. Elf32_Word *plt, *data_words, index, offset;
  203. plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
  204. offset = reloc_addr - plt;
  205. index = (offset - PLT_INITIAL_ENTRY_WORDS)/2;
  206. data_words = (Elf32_Word *)tpnt->data_words;
  207. reloc_addr += 1;
  208. data_words[index] = finaladdr;
  209. PPC_SYNC;
  210. *reloc_addr = OPCODE_B ((PLT_LONGBRANCH_ENTRY_WORDS - (offset+1)) * 4);
  211. }
  212. /* instructions were modified */
  213. PPC_DCBST(reloc_addr);
  214. PPC_SYNC;
  215. PPC_ICBI(reloc_addr);
  216. PPC_ISYNC;
  217. return finaladdr;
  218. }
  219. static inline int
  220. _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
  221. ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)
  222. {
  223. int reloc_type;
  224. int symtab_index;
  225. char *symname;
  226. Elf32_Addr *reloc_addr;
  227. Elf32_Addr finaladdr;
  228. unsigned long symbol_addr;
  229. #if defined (__SUPPORT_LD_DEBUG__)
  230. unsigned long old_val;
  231. #endif
  232. reloc_addr = (Elf32_Addr *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
  233. reloc_type = ELF32_R_TYPE(rpnt->r_info);
  234. if (reloc_type == R_PPC_RELATIVE) {
  235. *reloc_addr = tpnt->loadaddr + rpnt->r_addend;
  236. return 0;
  237. }
  238. if (reloc_type == R_PPC_NONE)
  239. return 0;
  240. symtab_index = ELF32_R_SYM(rpnt->r_info);
  241. symname = strtab + symtab[symtab_index].st_name;
  242. symbol_addr = (unsigned long) _dl_find_hash(symname, scope->dyn->symbol_scope,
  243. elf_machine_type_class(reloc_type));
  244. /*
  245. * We want to allow undefined references to weak symbols - this might
  246. * have been intentional. We should not be linking local symbols
  247. * here, so all bases should be covered.
  248. */
  249. if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) == STB_GLOBAL) {
  250. #if defined (__SUPPORT_LD_DEBUG__)
  251. _dl_dprintf(2, "\tglobal symbol '%s' already defined in '%s', rel type: %s\n",
  252. symname, tpnt->libname, _dl_reltypes(reloc_type));
  253. #endif
  254. return 0;
  255. }
  256. #if defined (__SUPPORT_LD_DEBUG__)
  257. old_val = *reloc_addr;
  258. #endif
  259. finaladdr = (Elf32_Addr) (symbol_addr + rpnt->r_addend);
  260. switch (reloc_type) {
  261. case R_PPC_ADDR32:
  262. case R_PPC_GLOB_DAT:
  263. *reloc_addr = finaladdr;
  264. return 0; /* No code code modified */
  265. break;
  266. case R_PPC_JMP_SLOT:
  267. {
  268. Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
  269. if (delta<<6>>6 == delta) {
  270. *reloc_addr = OPCODE_B(delta);
  271. } else if (finaladdr <= 0x01fffffc) {
  272. *reloc_addr = OPCODE_BA (finaladdr);
  273. } else {
  274. /* Warning: we don't handle double-sized PLT entries */
  275. Elf32_Word *plt, *data_words, index, offset;
  276. plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
  277. offset = reloc_addr - plt;
  278. index = (offset - PLT_INITIAL_ENTRY_WORDS)/2;
  279. data_words = (Elf32_Word *)tpnt->data_words;
  280. data_words[index] = finaladdr;
  281. reloc_addr[0] = OPCODE_LI(11,index*4);
  282. reloc_addr[1] = OPCODE_B((PLT_LONGBRANCH_ENTRY_WORDS - (offset+1)) * 4);
  283. /* instructions were modified */
  284. PPC_DCBST(reloc_addr+1);
  285. PPC_SYNC;
  286. PPC_ICBI(reloc_addr+1);
  287. }
  288. break;
  289. }
  290. case R_PPC_COPY:
  291. if (symbol_addr) {
  292. #if defined (__SUPPORT_LD_DEBUG__)
  293. if(_dl_debug_move)
  294. _dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
  295. symname, symtab[symtab_index].st_size,
  296. symbol_addr, symtab[symtab_index].st_value);
  297. #endif
  298. _dl_memcpy((char *) reloc_addr, (char *) finaladdr, symtab[symtab_index].st_size);
  299. }
  300. return 0; /* No code code modified */
  301. break;
  302. case R_PPC_ADDR16_HA:
  303. *(short *)reloc_addr = (finaladdr + 0x8000)>>16;
  304. break;
  305. case R_PPC_ADDR16_HI:
  306. *(short *)reloc_addr = finaladdr >> 16;
  307. break;
  308. case R_PPC_ADDR16_LO:
  309. *(short *)reloc_addr = finaladdr;
  310. break;
  311. case R_PPC_REL24:
  312. {
  313. Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
  314. if(delta<<6>>6 != delta){
  315. _dl_dprintf(2, "%s: symbol '%s' R_PPC_REL24 is out of range.\n\t"
  316. "Compile shared libraries with -fPIC!\n",
  317. _dl_progname, symname);
  318. _dl_exit(1);
  319. }
  320. *reloc_addr = (*reloc_addr & 0xfc000003) | (delta & 0x3fffffc);
  321. break;
  322. }
  323. default:
  324. _dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname);
  325. #if defined (__SUPPORT_LD_DEBUG__)
  326. _dl_dprintf(2, "%s ", _dl_reltypes(reloc_type));
  327. #endif
  328. if (symtab_index)
  329. _dl_dprintf(2, "'%s'\n", symname);
  330. return -1;
  331. };
  332. /* instructions were modified */
  333. PPC_DCBST(reloc_addr);
  334. PPC_SYNC;
  335. PPC_ICBI(reloc_addr);
  336. PPC_ISYNC;
  337. #if defined (__SUPPORT_LD_DEBUG__)
  338. if(_dl_debug_reloc && _dl_debug_detail)
  339. _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
  340. #endif
  341. return 0;
  342. }
  343. void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
  344. unsigned long rel_addr, unsigned long rel_size, int type)
  345. {
  346. struct elf_resolve *tpnt = rpnt->dyn;
  347. Elf32_Word *plt, offset, i, num_plt_entries, rel_offset_words;
  348. (void) type;
  349. num_plt_entries = rel_size / sizeof(ELF_RELOC);
  350. /* When the dynamic linker bootstrapped itself, it resolved some symbols.
  351. Make sure we do not do them again */
  352. if (tpnt->libtype == program_interpreter)
  353. return;
  354. rel_offset_words = PLT_DATA_START_WORDS(num_plt_entries);
  355. plt = (Elf32_Word *)(tpnt->dynamic_info[DT_PLTGOT] + tpnt->loadaddr);
  356. /* Set up the lazy PLT entries. */
  357. offset = PLT_INITIAL_ENTRY_WORDS;
  358. i = 0;
  359. /* Warning: we don't handle double-sized PLT entries */
  360. while (i < num_plt_entries) {
  361. plt[offset ] = OPCODE_LI(11, i * 4);
  362. plt[offset+1] = OPCODE_B((PLT_TRAMPOLINE_ENTRY_WORDS + 2 - (offset+1)) * 4);
  363. i++;
  364. offset += 2;
  365. }
  366. /* Now, we've modified code. We need to write the changes from
  367. the data cache to a second-level unified cache, then make
  368. sure that stale data in the instruction cache is removed.
  369. (In a multiprocessor system, the effect is more complex.)
  370. Most of the PLT shouldn't be in the instruction cache, but
  371. there may be a little overlap at the start and the end.
  372. Assumes that dcbst and icbi apply to lines of 16 bytes or
  373. more. Current known line sizes are 16, 32, and 128 bytes. */
  374. for (i = 0; i < rel_offset_words; i += 4)
  375. PPC_DCBST (plt + i);
  376. PPC_DCBST (plt + rel_offset_words - 1);
  377. PPC_SYNC;
  378. PPC_ICBI (plt);
  379. PPC_ICBI (plt + rel_offset_words - 1);
  380. PPC_ISYNC;
  381. }
  382. static inline int
  383. _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
  384. unsigned long rel_addr, unsigned long rel_size,
  385. int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope,
  386. ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab))
  387. {
  388. unsigned int i;
  389. char *strtab;
  390. Elf32_Sym *symtab;
  391. ELF_RELOC *rpnt;
  392. int symtab_index;
  393. /* Now parse the relocation information */
  394. rpnt = (ELF_RELOC *)(intptr_t) (rel_addr + tpnt->loadaddr);
  395. rel_size = rel_size / sizeof(ELF_RELOC);
  396. symtab = (Elf32_Sym *)(intptr_t) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr);
  397. strtab = (char *) (tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
  398. for (i = 0; i < rel_size; i++, rpnt++) {
  399. int res;
  400. symtab_index = ELF32_R_SYM(rpnt->r_info);
  401. /* When the dynamic linker bootstrapped itself, it resolved some symbols.
  402. Make sure we do not do them again */
  403. if (!symtab_index && tpnt->libtype == program_interpreter)
  404. continue;
  405. if (symtab_index && tpnt->libtype == program_interpreter &&
  406. _dl_symbol(strtab + symtab[symtab_index].st_name))
  407. continue;
  408. #if defined (__SUPPORT_LD_DEBUG__)
  409. debug_sym(symtab,strtab,symtab_index);
  410. debug_reloc(symtab,strtab,rpnt);
  411. #endif
  412. res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
  413. if (res==0) continue;
  414. _dl_dprintf(2, "\n%s: ",_dl_progname);
  415. if (symtab_index)
  416. _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
  417. if (res <0)
  418. {
  419. int reloc_type = ELF32_R_TYPE(rpnt->r_info);
  420. #if defined (__SUPPORT_LD_DEBUG__)
  421. _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
  422. #else
  423. _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
  424. #endif
  425. _dl_exit(-res);
  426. }
  427. else if (res >0)
  428. {
  429. _dl_dprintf(2, "can't resolve symbol\n");
  430. return res;
  431. }
  432. }
  433. return 0;
  434. }
  435. int _dl_parse_relocation_information(struct dyn_elf *rpnt,
  436. unsigned long rel_addr, unsigned long rel_size, int type)
  437. {
  438. return _dl_parse(rpnt->dyn, rpnt, rel_addr, rel_size, _dl_do_reloc);
  439. }
  440. /* Should be a static inline instead, but that conflicts with ld_elf.h */
  441. int _dl_parse_copy_information(struct dyn_elf *rpnt,
  442. unsigned long rel_addr, unsigned long rel_size, int type)
  443. {
  444. /* Not used! */
  445. return 0;
  446. }