// File: /workspace/github_c_makefile_star2_O3/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 0x1920e
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa8d8(%rip), %rcx      # 0x23a90
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 0x15bf8
movl %r15d, (%rsp)
movl $0x4, %r8d
movl $0x4, %r9d
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
jmp 0x19294
leaq 0xae13(%rip), %rdi      # 0x24028
movl %r15d, %esi
xorl %eax, %eax
callq 0x52b0
jmp 0x192b2
movq %rbx, %rdi
callq 0x15b12
jmp 0x192b2
movq %rbx, %rdi
callq 0x167b6
movq %r14, %rdi
movl $0x1, %esi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x1629f
jmp 0x192b2
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 0x15bf8
movl %ebp, (%rsp)
movl $0x8, %r8d
movl $0xc, %r9d
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
callq 0x15f0b
jmp 0x192b4
cmpl $0x5, 0x44(%rbx)
jae 0x192bf
leaq 0x9300(%rip), %rsi      # 0x225a8
jmp 0x192c6
movq %rbx, %rdi
callq 0x167b6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x92d6(%rip), %rsi      # 0x2259c
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x161f7