// File: /workspace/github_c_makefile_star2_O1/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 0x19356
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa7b0(%rip), %rcx      # 0x23ab0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, (%rsp)
movl $0x10, %esi
movl $0x10, %edx
movq %r14, %rdi
movl $0x2, %ecx
movl $0x1, %r8d
movl $0x7, %r9d
callq 0x15db4
movl %r15d, (%rsp)
movl $0x4, %r8d
movl $0x4, %r9d
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
jmp 0x193dc
leaq 0xaceb(%rip), %rdi      # 0x24048
movl %r15d, %esi
xorl %eax, %eax
callq 0x52b0
jmp 0x193fa
movq %rbx, %rdi
callq 0x15cce
jmp 0x193fa
movq %rbx, %rdi
callq 0x16966
movq %r14, %rdi
movl $0x1, %esi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x16455
jmp 0x193fa
movl $0x2, %ebp
movl %ebp, (%rsp)
movl $0x48, %esi
movl $0x48, %edx
movq %r14, %rdi
movl $0x3, %ecx
movl $0x3, %r8d
movl $0x7, %r9d
callq 0x15db4
movl %ebp, (%rsp)
movl $0x8, %r8d
movl $0xc, %r9d
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
callq 0x160c1
jmp 0x193fc
cmpl $0x5, 0x44(%rbx)
jae 0x19407
leaq 0x91c8(%rip), %rsi      # 0x225b8
jmp 0x1940e
movq %rbx, %rdi
callq 0x16966
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x919e(%rip), %rsi      # 0x225ac
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x163af