1 /* Machine-dependent ELF dynamic relocation inline functions. PowerPC version.
2 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
23 #define ELF_MACHINE_NAME "powerpc"
28 #include <sys/param.h>
31 /* stuff for the PLT */
32 #define PLT_INITIAL_ENTRY_WORDS 18
33 #define PLT_LONGBRANCH_ENTRY_WORDS 10
34 #define PLT_DOUBLE_SIZE (1<<13)
35 #define PLT_ENTRY_START_WORDS(entry_number) \
36 (PLT_INITIAL_ENTRY_WORDS + (entry_number)*2 + \
37 ((entry_number) > PLT_DOUBLE_SIZE ? \
38 ((entry_number) - PLT_DOUBLE_SIZE)*2 : \
40 #define PLT_DATA_START_WORDS(num_entries) PLT_ENTRY_START_WORDS(num_entries)
42 #define OPCODE_ADDI(rd,ra,simm) \
43 (0x38000000 | (rd) << 21 | (ra) << 16 | (simm) & 0xffff)
44 #define OPCODE_ADDIS(rd,ra,simm) \
45 (0x3c000000 | (rd) << 21 | (ra) << 16 | (simm) & 0xffff)
46 #define OPCODE_ADD(rd,ra,rb) \
47 (0x7c000214 | (rd) << 21 | (ra) << 16 | (rb) << 11)
48 #define OPCODE_B(target) (0x48000000 | (target) & 0x03fffffc)
49 #define OPCODE_BA(target) (0x48000002 | (target) & 0x03fffffc)
50 #define OPCODE_BCTR() 0x4e800420
51 #define OPCODE_LWZ(rd,d,ra) \
52 (0x80000000 | (rd) << 21 | (ra) << 16 | (d) & 0xffff)
53 #define OPCODE_MTCTR(rd) (0x7C0903A6 | (rd) << 21)
54 #define OPCODE_RLWINM(ra,rs,sh,mb,me) \
55 (0x54000000 | (rs) << 21 | (ra) << 16 | (sh) << 11 | (mb) << 6 | (me) << 1)
57 #define OPCODE_LI(rd,simm) OPCODE_ADDI(rd,0,simm)
58 #define OPCODE_SLWI(ra,rs,sh) OPCODE_RLWINM(ra,rs,sh,0,31-sh)
60 #define PPC_DCBST(where) asm volatile ("dcbst 0,%0" : : "r"(where))
61 #define PPC_SYNC asm volatile ("sync")
62 #define PPC_ISYNC asm volatile ("sync; isync")
63 #define PPC_ICBI(where) asm volatile ("icbi 0,%0" : : "r"(where))
64 #define PPC_DIE asm volatile ("tweq 0,0")
66 /* Use this when you've modified some code, but it won't be in the
67 instruction fetch queue (or when it doesn't matter if it is). */
68 #define MODIFIED_CODE_NOQUEUE(where) \
69 do { PPC_DCBST(where); PPC_SYNC; PPC_ICBI(where); } while (0)
70 /* Use this when it might be in the instruction queue. */
71 #define MODIFIED_CODE(where) \
72 do { PPC_DCBST(where); PPC_SYNC; PPC_ICBI(where); PPC_ISYNC; } while (0)
75 /* Return nonzero iff E_MACHINE is compatible with the running host. */
77 elf_machine_matches_host (Elf32_Half e_machine
)
79 return e_machine
== EM_PPC
;
83 /* Return the link-time address of _DYNAMIC, stored as
84 the first value in the GOT. */
85 static inline Elf32_Addr
86 elf_machine_dynamic (void)
89 asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
94 /* Return the run-time load address of the shared object. */
95 static inline Elf32_Addr
96 elf_machine_load_address (void)
101 /* This is much harder than you'd expect. Possibly I'm missing something.
104 Apparently, "bcl 20,31,$+4" is what should be used to load LR
105 with the address of the next instruction.
106 I think this is so that machines that do bl/blr pairing don't
109 asm ("bcl 20,31,0f ;"
114 : "=b" (addr) : : "r0", "lr");
116 doesn't work, because the linker doesn't have to (and in fact doesn't)
117 update the @ha and @l references; the loader (which runs after this
120 Instead, we use the following trick:
122 The linker puts the _link-time_ address of _DYNAMIC at the first
123 word in the GOT. We could branch to that address, if we wanted,
124 by using an @local reloc; the linker works this out, so it's safe
125 to use now. We can't, of course, actually branch there, because
126 we'd cause an illegal instruction exception; so we need to compute
127 the address ourselves. That gives us the following code: */
129 /* Get address of the 'b _DYNAMIC@local'... */
135 /* ... and the address of the GOT. */
136 asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
139 /* So now work out the difference between where the branch actually points,
140 and the offset of that location in memory from the start of the file. */
141 return ((Elf32_Addr
)branchaddr
- *got
142 + (*branchaddr
& 0x3fffffc
143 | (int)(*branchaddr
<< 6 & 0x80000000) >> 6));
146 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) /* nothing */
148 /* The PLT uses Elf32_Rela relocs. */
149 #define elf_machine_relplt elf_machine_rela
151 /* This code is used in dl-runtime.c to call the `fixup' function
152 and then redirect to the address it returns. It is called
153 from code built in the PLT by elf_machine_runtime_setup. */
154 #define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
157 .globl _dl_runtime_resolve
158 .type _dl_runtime_resolve,@function
160 # We need to save the registers used to pass parameters, and register 0,
161 # which is used by _mcount; the registers are saved in a stack frame.
166 # The code that calls this has put parameters for `fixup' in r12 and r11.
172 # We also need to save some of the condition register fields.
181 # 'fixup' returns the address we want to branch to.
183 # Put the registers back...
197 # ...unwind the stack frame, and jump to the PLT entry we updated.
200 .size _dl_runtime_resolve,.-_dl_runtime_resolve
203 .globl _dl_prof_resolve
204 .type _dl_prof_resolve,@function
206 # We need to save the registers used to pass parameters, and register 0,
207 # which is used by _mcount; the registers are saved in a stack frame.
212 # The code that calls this has put parameters for `fixup' in r12 and r11.
218 # We also need to save some of the condition register fields.
226 bl profile_fixup@local
227 # 'fixup' returns the address we want to branch to.
229 # Put the registers back...
243 # ...unwind the stack frame, and jump to the PLT entry we updated.
247 .size _dl_prof_resolve,0b-_dl_prof_resolve
248 # Undo '.section text'.
252 /* Initial entry point code for the dynamic linker.
253 The C function `_dl_start' is the real entry point;
254 its return value is the user program's entry point. */
256 static ElfW(Addr) _dl_start (void *arg) __attribute__((unused)); \
261 .type _start,@function
263 # We start with the following on the stack, from top:
265 # arguments for program (terminated by NULL);
266 # environment variables (terminated by NULL);
267 # arguments for the program loader.
268 # FIXME: perhaps this should do the same trick as elf/start.c?
270 # Call _dl_start with one parameter pointing at argc
272 # (we have to frob the stack pointer a bit to allow room for
273 # _dl_start to save the link register)
279 # Now, we do our main work of calling initialisation procedures.
280 # The ELF ABI doesn't say anything about parameters for these,
281 # so we just pass argc, argv, and the environment.
282 # Changing these is strongly discouraged (not least because argc is
285 # Put our GOT pointer in r31,
286 bl _GLOBAL_OFFSET_TABLE_-4@local
288 # the address of _start in r30,
290 # &_dl_argc in 29, &_dl_argv in 27, and _dl_default_scope in 28.
291 lwz 28,_dl_default_scope@got(31)
292 lwz 29,_dl_argc@got(31)
293 lwz 27,_dl_argv@got(31)
295 # Set initfunc = _dl_init_next(_dl_default_scope[2])
298 # If initfunc is NULL, we exit the loop; otherwise,
301 # call initfunc(_dl_argc, _dl_argv, _dl_argv+_dl_argc+1)
312 # Now, to conform to the ELF ABI, we have to:
313 # Pass argc (actually _dl_argc) in r3;
315 # pass argv (actually _dl_argv) in r4;
317 # pass envp (actually _dl_argv+_dl_argc+1) in r5;
321 # pass the auxilary vector in r6. This is passed to us just after _envp.
326 # Pass a termination function pointer (in this case _dl_fini) in r7.
327 lwz 7,_dl_fini@got(31)
328 # Now, call the start function in r30...
330 lwz 26,_dl_starting_up@got(31)
331 # Pass the stack pointer in r1 (so far so good), pointing to a NULL value.
332 # (This lets our startup code distinguish between a program linked statically,
333 # which linux will call with argc on top of the stack which will hopefully
334 # never be zero, and a dynamically linked program which will always have
335 # a NULL on the top of the stack).
336 # Take the opportunity to clear LR, so anyone who accidentally returns
337 # from _start gets SEGV. Also clear the next few words of the stack.
344 # Clear _dl_starting_up.
349 .size _start,0b-_start
350 # Undo '.section text'.
354 /* The idea here is that to conform to the ABI, we are supposed to try
355 to load dynamic objects between 0x10000 (we actually use 0x40000 as
356 the lower bound, to increase the chance of a memory reference from
357 a null pointer giving a segfault) and the program's load address.
358 Regrettably, in this code we can't find the program's load address,
359 so we punt and choose 0x01800000, which is below the ABI's
360 recommended default, and what GNU ld currently chooses. We only use
361 the address as a preference for mmap, so if we get it wrong the
362 worst that happens is that it gets mapped somewhere else.
364 FIXME: Unfortunately, 'somewhere else' is probably right after the
365 program's break, which causes malloc to fail. We really need more
366 information here about the way memory is mapped. */
368 #define ELF_PREFERRED_ADDRESS_DATA \
369 static ElfW(Addr) _dl_preferred_address = 1
371 #define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) \
374 if (mapstartpref != 0 && _dl_preferred_address == 1) \
375 _dl_preferred_address = mapstartpref; \
376 if (mapstartpref != 0) \
377 prefd = mapstartpref; \
378 else if (_dl_preferred_address == 1) \
379 prefd = _dl_preferred_address = \
380 (0x01800000 - maplength - 0x10000) & \
381 ~(_dl_pagesize - 1); \
382 else if (_dl_preferred_address < maplength + 0x50000) \
385 prefd = _dl_preferred_address = \
386 ((_dl_preferred_address - maplength - 0x10000) \
387 & ~(_dl_pagesize - 1)); \
391 #define ELF_FIXED_ADDRESS(loader, mapstart) \
393 if (mapstart != 0 && _dl_preferred_address == 1) \
394 _dl_preferred_address = mapstart; \
397 /* Nonzero iff TYPE should not be allowed to resolve to one of
398 the main executable's symbols, as for a COPY reloc. */
399 #define elf_machine_lookup_noexec_p(type) ((type) == R_PPC_COPY)
401 /* Nonzero iff TYPE describes relocation of a PLT entry, so
402 PLT entries should not be allowed to define the value. */
403 /* We never want to use a PLT entry as the destination of a
404 reloc, when what is being relocated is a branch. This is
405 partly for efficiency, but mostly so we avoid loops. */
406 #define elf_machine_lookup_noplt_p(type) ((type) == R_PPC_REL24 || \
407 (type) == R_PPC_ADDR24 || \
408 (type) == R_PPC_JMP_SLOT)
410 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
411 #define ELF_MACHINE_JMP_SLOT R_PPC_JMP_SLOT
413 /* Nonzero iff TYPE describes relocation of a PLT entry, so
414 PLT entries should not be allowed to define the value. */
415 #define elf_machine_pltrel_p(type) ((type) == R_PPC_JMP_SLOT)
417 /* Set up the loaded object described by L so its unrelocated PLT
418 entries will jump to the on-demand fixup code in dl-runtime.c.
419 Also install a small trampoline to be used by entries that have
420 been relocated to an address too far away for a single branch. */
422 /* A PLT entry does one of three things:
423 (i) Jumps to the actual routine. Such entries are set up above, in
426 (ii) Jumps to the actual routine via glue at the start of the PLT.
427 We do this by putting the address of the routine in space
428 allocated at the end of the PLT, and when the PLT entry is
429 called we load the offset of that word (from the start of the
430 space) into r11, then call the glue, which loads the word and
431 branches to that address. These entries are set up in
432 elf_machine_rela, but the glue is set up here.
434 (iii) Loads the index of this PLT entry (we count the double-size
435 entries as one entry for this purpose) into r11, then
436 branches to code at the start of the PLT. This code then
437 calls `fixup', in dl-runtime.c, via the glue in the macro
438 ELF_MACHINE_RUNTIME_TRAMPOLINE, which resets the PLT entry to
439 be one of the above two types. These entries are set up here. */
441 elf_machine_runtime_setup (struct link_map
*map
, int lazy
, int profile
)
443 if (map
->l_info
[DT_JMPREL
])
446 /* Fill in the PLT. Its initial contents are directed to a
447 function earlier in the PLT which arranges for the dynamic
448 linker to be called back. */
449 Elf32_Word
*plt
= (Elf32_Word
*) ((char *) map
->l_addr
450 + map
->l_info
[DT_PLTGOT
]->d_un
.d_val
);
451 Elf32_Word num_plt_entries
= (map
->l_info
[DT_PLTRELSZ
]->d_un
.d_val
452 / sizeof (Elf32_Rela
));
453 Elf32_Word rel_offset_words
= PLT_DATA_START_WORDS (num_plt_entries
);
454 Elf32_Word size_modified
;
455 extern void _dl_runtime_resolve (void);
456 extern void _dl_prof_resolve (void);
459 dlrr
= (Elf32_Word
)(char *)(profile
461 : _dl_runtime_resolve
);
464 for (i
= 0; i
< num_plt_entries
; i
++)
466 Elf32_Word offset
= PLT_ENTRY_START_WORDS (i
);
468 if (i
>= PLT_DOUBLE_SIZE
)
470 plt
[offset
] = OPCODE_LI (11, i
* 4);
471 plt
[offset
+1] = OPCODE_ADDIS (11, 11, (i
* 4 + 0x8000) >> 16);
472 plt
[offset
+2] = OPCODE_B (-(4 * (offset
+ 2)));
476 plt
[offset
] = OPCODE_LI (11, i
* 4);
477 plt
[offset
+1] = OPCODE_B (-(4 * (offset
+ 1)));
481 /* Multiply index of entry by 3 (in r11). */
482 plt
[0] = OPCODE_SLWI (12, 11, 1);
483 plt
[1] = OPCODE_ADD (11, 12, 11);
484 if (dlrr
<= 0x01fffffc || dlrr
>= 0xfe000000)
486 /* Load address of link map in r12. */
487 plt
[2] = OPCODE_LI (12, (Elf32_Word
) (char *) map
);
488 plt
[3] = OPCODE_ADDIS (12, 12, (((Elf32_Word
) (char *) map
491 /* Call _dl_runtime_resolve. */
492 plt
[4] = OPCODE_BA (dlrr
);
496 /* Get address of _dl_runtime_resolve in CTR. */
497 plt
[2] = OPCODE_LI (12, dlrr
);
498 plt
[3] = OPCODE_ADDIS (12, 12, (dlrr
+ 0x8000) >> 16);
499 plt
[4] = OPCODE_MTCTR (12);
501 /* Load address of link map in r12. */
502 plt
[5] = OPCODE_LI (12, (Elf32_Word
) (char *) map
);
503 plt
[6] = OPCODE_ADDIS (12, 12, (((Elf32_Word
) (char *) map
506 /* Call _dl_runtime_resolve. */
507 plt
[7] = OPCODE_BCTR ();
511 /* Convert the index in r11 into an actual address, and get the
512 word at that address. */
513 plt
[PLT_LONGBRANCH_ENTRY_WORDS
] =
514 OPCODE_ADDIS (11, 11, (((Elf32_Word
) (char*) (plt
+ rel_offset_words
)
516 plt
[PLT_LONGBRANCH_ENTRY_WORDS
+1] =
517 OPCODE_LWZ (11, (Elf32_Word
) (char*) (plt
+rel_offset_words
), 11);
519 /* Call the procedure at that address. */
520 plt
[PLT_LONGBRANCH_ENTRY_WORDS
+2] = OPCODE_MTCTR (11);
521 plt
[PLT_LONGBRANCH_ENTRY_WORDS
+3] = OPCODE_BCTR ();
524 /* Now, we've modified code (quite a lot of code, possibly). We
525 need to write the changes from the data cache to a
526 second-level unified cache, then make sure that stale data in
527 the instruction cache is removed. (In a multiprocessor
528 system, the effect is more complex.)
530 Assumes the cache line size is at least 32 bytes, or at least
531 that dcbst and icbi apply to 32-byte lines. At present, all
532 PowerPC processors have line sizes of exactly 32 bytes. */
534 size_modified
= lazy
? rel_offset_words
: PLT_INITIAL_ENTRY_WORDS
;
535 for (i
= 0; i
< size_modified
; i
+=8)
538 for (i
= 0; i
< size_modified
; i
+=8)
547 elf_machine_lazy_rel (struct link_map
*map
, const Elf32_Rela
*reloc
)
549 /* elf_machine_runtime_setup handles this. */
553 elf_machine_fixup_plt(struct link_map
*map
, const Elf32_Rela
*reloc
,
554 Elf32_Addr
*reloc_addr
, Elf32_Addr finaladdr
)
556 Elf32_Sword delta
= finaladdr
- (Elf32_Word
) (char *) reloc_addr
;
557 if (delta
<< 6 >> 6 == delta
)
558 *reloc_addr
= OPCODE_B (delta
);
559 else if (finaladdr
<= 0x01fffffc || finaladdr
>= 0xfe000000)
560 *reloc_addr
= OPCODE_BA (finaladdr
);
566 plt
= (Elf32_Word
*)((char *)map
->l_addr
567 + map
->l_info
[DT_PLTGOT
]->d_un
.d_val
);
568 index
= (reloc_addr
- plt
- PLT_INITIAL_ENTRY_WORDS
)/2;
569 if (index
>= PLT_DOUBLE_SIZE
)
571 /* Slots greater than or equal to 2^13 have 4 words available
573 /* FIXME: There are some possible race conditions in this code,
574 when called from 'fixup'.
576 1) Suppose that a lazy PLT entry is executing, a context switch
577 between threads (or a signal) occurs, and the new thread or
578 signal handler calls the same lazy PLT entry. Then the PLT entry
579 would be changed while it's being run, which will cause a segfault
582 2) Suppose the reverse: that a lazy PLT entry is being updated,
583 a context switch occurs, and the new code calls the lazy PLT
584 entry that is being updated. Then the half-fixed PLT entry will
585 be executed, which will also almost always cause a segfault.
587 These problems don't happen with the 2-word entries, because
588 only one of the two instructions are changed when a lazy entry
589 is retargeted at the actual PLT entry; the li instruction stays
590 the same (we have to update it anyway, because we might not be
591 updating a lazy PLT entry). */
593 reloc_addr
[0] = OPCODE_LI (11, finaladdr
);
594 reloc_addr
[1] = OPCODE_ADDIS (11, 11, finaladdr
+ 0x8000 >> 16);
595 reloc_addr
[2] = OPCODE_MTCTR (11);
596 reloc_addr
[3] = OPCODE_BCTR ();
600 Elf32_Word num_plt_entries
;
602 num_plt_entries
= (map
->l_info
[DT_PLTRELSZ
]->d_un
.d_val
603 / sizeof(Elf32_Rela
));
605 plt
[index
+PLT_DATA_START_WORDS (num_plt_entries
)] = finaladdr
;
606 reloc_addr
[0] = OPCODE_LI (11, index
*4);
607 reloc_addr
[1] = OPCODE_B (-(4*(index
*2
609 - PLT_LONGBRANCH_ENTRY_WORDS
610 + PLT_INITIAL_ENTRY_WORDS
)));
613 MODIFIED_CODE (reloc_addr
);
616 /* Return the final value of a plt relocation. */
617 static inline Elf32_Addr
618 elf_machine_plt_value (struct link_map
*map
, const Elf32_Rela
*reloc
,
621 return value
+ reloc
->r_addend
;
624 #endif /* dl_machine_h */
628 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
629 LOADADDR is the load address of the object; INFO is an array indexed
630 by DT_* of the .dynamic section info. */
633 elf_machine_rela (struct link_map
*map
, const Elf32_Rela
*reloc
,
634 const Elf32_Sym
*sym
, const struct r_found_version
*version
,
635 Elf32_Addr
*const reloc_addr
)
637 #ifndef RTLD_BOOTSTRAP
638 const Elf32_Sym
*const refsym
= sym
;
639 extern char **_dl_argv
;
641 Elf32_Word loadbase
, finaladdr
;
642 const int rinfo
= ELF32_R_TYPE (reloc
->r_info
);
644 if (rinfo
== R_PPC_NONE
)
647 assert (sym
!= NULL
);
648 /* The condition on the next two lines is a hack around a bug in Solaris
649 tools on Sparc. It's not clear whether it should really be here at all,
650 but if not the binutils need to be changed. */
651 if ((sym
->st_shndx
!= SHN_UNDEF
652 && ELF32_ST_BIND (sym
->st_info
) == STB_LOCAL
)
653 || rinfo
== R_PPC_RELATIVE
)
655 /* Has already been relocated. */
656 loadbase
= map
->l_addr
;
657 finaladdr
= loadbase
+ reloc
->r_addend
;
661 loadbase
= (Elf32_Word
) (char *) (RESOLVE (&sym
, version
,
662 ELF32_R_TYPE(reloc
->r_info
)));
665 /* Weak symbol that wasn't actually defined anywhere. */
666 assert(loadbase
== 0);
667 finaladdr
= reloc
->r_addend
;
670 finaladdr
= (loadbase
+ (Elf32_Word
) (char *) sym
->st_value
674 /* This is still an if/else if chain because GCC uses the GOT to find
675 the table for table-based switch statements, and we haven't set it
677 if (rinfo
== R_PPC_UADDR32
||
678 rinfo
== R_PPC_GLOB_DAT
||
679 rinfo
== R_PPC_ADDR32
||
680 rinfo
== R_PPC_RELATIVE
)
682 *reloc_addr
= finaladdr
;
684 #ifndef RTLD_BOOTSTRAP
685 else if (rinfo
== R_PPC_ADDR16_LO
)
687 *(Elf32_Half
*) reloc_addr
= finaladdr
;
689 else if (rinfo
== R_PPC_ADDR16_HI
)
691 *(Elf32_Half
*) reloc_addr
= finaladdr
>> 16;
693 else if (rinfo
== R_PPC_ADDR16_HA
)
695 *(Elf32_Half
*) reloc_addr
= (finaladdr
+ 0x8000) >> 16;
697 else if (rinfo
== R_PPC_REL24
)
699 Elf32_Sword delta
= finaladdr
- (Elf32_Word
) (char *) reloc_addr
;
700 if (delta
<< 6 >> 6 != delta
)
702 _dl_signal_error(0, map
->l_name
,
703 "R_PPC_REL24 relocation out of range");
705 *reloc_addr
= *reloc_addr
& 0xfc000003 | delta
& 0x3fffffc;
707 else if (rinfo
== R_PPC_ADDR24
)
709 if (finaladdr
<< 6 >> 6 != finaladdr
)
711 _dl_signal_error(0, map
->l_name
,
712 "R_PPC_ADDR24 relocation out of range");
714 *reloc_addr
= *reloc_addr
& 0xfc000003 | finaladdr
& 0x3fffffc;
716 else if (rinfo
== R_PPC_COPY
)
719 /* This can happen in trace mode when an object could not be
722 if (sym
->st_size
> refsym
->st_size
723 || (_dl_verbose
&& sym
->st_size
< refsym
->st_size
))
727 strtab
= ((void *) map
->l_addr
728 + map
->l_info
[DT_STRTAB
]->d_un
.d_ptr
);
729 _dl_sysdep_error (_dl_argv
[0] ?: "<program name unknown>",
730 ": Symbol `", strtab
+ refsym
->st_name
,
731 "' has different size in shared object, "
732 "consider re-linking\n", NULL
);
734 memcpy (reloc_addr
, (char *) finaladdr
, MIN (sym
->st_size
,
738 else if (rinfo
== R_PPC_REL32
)
740 *reloc_addr
= finaladdr
- (Elf32_Word
) (char *) reloc_addr
;
742 else if (rinfo
== R_PPC_JMP_SLOT
)
744 elf_machine_fixup_plt (map
, reloc
, reloc_addr
, finalvalue
);
748 #ifdef RTLD_BOOTSTRAP
749 PPC_DIE
; /* There is no point calling _dl_sysdep_error, it
750 almost certainly hasn't been relocated properly. */
752 _dl_sysdep_error (_dl_argv
[0] ?: "<program name unknown>",
753 ": Unknown relocation type\n", NULL
);
757 #ifndef RTLD_BOOTSTRAP
758 if (rinfo
== R_PPC_ADDR16_LO
||
759 rinfo
== R_PPC_ADDR16_HI
||
760 rinfo
== R_PPC_ADDR16_HA
||
761 rinfo
== R_PPC_REL24
||
762 rinfo
== R_PPC_ADDR24
)
763 MODIFIED_CODE_NOQUEUE (reloc_addr
);
767 #define ELF_MACHINE_NO_REL 1