// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/t_elf32ppcbe.c
// Function: ppc32be_dynentry
static struct Symbol *ppc32be_dynentry(struct GlobalVars *gv,DynArg a,int etype)
/* Create an entry into .got/.plt/.bss for the referenced symbol. */
{
  struct Symbol *entry_sym = NULL;
  struct Section *sec;
  const char *bssname;

  switch (etype) {

    case GOT_ENTRY:
    case GOT_LOCAL:
      /* .got has 4 reserved words at the beginning,
         is writable and executable (contains a blrl in first word),
         a new entry occupies 1 word. */
      sec = elf32_dyntable(gv,16,16,ST_DATA,SF_ALLOC,
                           SP_READ|SP_WRITE|SP_EXEC,GOT_ENTRY);
      entry_sym = elf32_pltgotentry(gv,sec,a,SYMI_OBJECT,4,4,etype);
      break;

    case PLT_ENTRY:
      /* .plt has 18 reserved words at the beginning,
         is writable and executable, but uninitialized for PPC,
         a new entry occupies 2 words and 1 additional word at the end */
      sec = elf32_dyntable(gv,72,72,ST_UDATA,SF_ALLOC|SF_UNINITIALIZED,
                           SP_READ|SP_WRITE|SP_EXEC,PLT_ENTRY);
      entry_sym = elf32_pltgotentry(gv,sec,a,SYMI_FUNC,8,12,PLT_ENTRY);
      break;

    case BSS_ENTRY:
      /* small objects are copied to .sbss, larger ones to .bss */
      bssname = (a.sym->size <= SBSS_MAXSIZE) ? sbss_name : bss_name;
      entry_sym = elf32_bssentry(gv,bssname,a.sym);
      break;

    case STR_ENTRY:
      /* enter StrTabList .dynstr */
      elf32_adddynstr(a.name);
      break;

    case SYM_ENTRY:
      /* enter SymTabList .dynsym and name to .dynstr */
      elf32_adddynsym(a.sym);
      break;

    case SO_NEEDED:
      /* denote shared object's name as 'needed' */
      elf32_dynamicentry(gv,DT_NEEDED,elf32_adddynstr(a.name),NULL);
      break;

    default:
      ierror("ppc32be_dynentry(): illegal entrytype: %d",etype);
      break;
  }

  return entry_sym;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
leal -0x1(%r15), %eax
cmpl $0x7, %eax
ja 0x17cdc
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x9e13(%rip), %rcx      # 0x21aac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, (%rsp)
pushq $0x10
popq %rdx
pushq $0x2
popq %rcx
pushq $0x1
popq %rbp
pushq $0x7
popq %r9
movq %r14, %rdi
movq %rdx, %rsi
movl %ebp, %r8d
callq 0x14a58
movl %r15d, (%rsp)
pushq $0x4
popq %r8
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movq %r8, %r9
jmp 0x17d46
leaq 0x9f75(%rip), %rdi      # 0x21c58
movl %r15d, %esi
xorl %eax, %eax
callq 0x6b2c
jmp 0x17d64
movq %rbx, %rdi
callq 0x14978
jmp 0x17d64
movq %rbx, %rdi
callq 0x15590
pushq $0x1
popq %rsi
movq %r14, %rdi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x150e7
jmp 0x17d64
pushq $0x2
popq %rbp
movl %ebp, (%rsp)
pushq $0x48
popq %rdx
pushq $0x3
popq %rcx
pushq $0x7
popq %r9
movq %r14, %rdi
movq %rdx, %rsi
movl %ecx, %r8d
callq 0x14a58
movl %ebp, (%rsp)
pushq $0x8
popq %r8
pushq $0xc
popq %r9
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x14d64
jmp 0x17d66
cmpl $0x5, 0x44(%rbx)
jae 0x17d71
leaq 0x885e(%rip), %rsi      # 0x205b8
jmp 0x17d78
movq %rbx, %rdi
callq 0x15590
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8834(%rip), %rsi      # 0x205ac
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x15037