// File: /workspace/github_c_makefile_star2_O3/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_setlnksym
void elf32_setlnksym(struct GlobalVars *gv,struct Symbol *xdef)
/* Initialize common ELF32 linker symbol structure during resolve_xref() */
{
  if (xdef->flags & SYMF_LNKSYM) {
    struct LinkedSection *ls;

    switch (xdef->extra) {
      case SDABASE:
        if (!(ls = find_lnksec(gv,sdata_name,ST_DATA,0,0,0)))
          if (!(ls = find_lnksec(gv,sbss_name,ST_UDATA,0,0,0)))
            ls = smalldata_section(gv);
        xdef->relsect = (struct Section *)ls->sections.first;
        break;
      case SDA2BASE:
        if (!(ls = find_lnksec(gv,sdata2_name,ST_DATA,0,0,0)))
          if (!(ls = find_lnksec(gv,sbss2_name,ST_UDATA,0,0,0)))
            ls = smalldata_section(gv);
        xdef->relsect = (struct Section *)ls->sections.first;
        break;
      case CTORS:
        if (ls = find_lnksec(gv,ctors_name,0,0,0,0)) {
          xdef->type = SYM_RELOC;
          xdef->relsect = (struct Section *)ls->sections.first;
        }
        break;
      case DTORS:
        if (ls = find_lnksec(gv,dtors_name,0,0,0,0)) {
          xdef->type = SYM_RELOC;
          xdef->relsect = (struct Section *)ls->sections.first;
        }
        break;
      case GLOBOFFSTAB:
        if (ls = find_lnksec(gv,got_name,0,0,0,0)) {
          xdef->type = SYM_RELOC;
          xdef->relsect = (struct Section *)ls->sections.first;
        }
        break;
      case PROCLINKTAB:
        if (ls = find_lnksec(gv,plt_name,0,0,0,0)) {
          xdef->type = SYM_RELOC;
          xdef->relsect = (struct Section *)ls->sections.first;
        }
        break;
      case DYNAMICSYM:
        if (ls = find_lnksec(gv,dyn_name,0,0,0,0)) {
          xdef->value = ls->base;
        }
        /* @@@ when .dynamic was not created _DYNAMIC stays NULL - ok? */
        break;
    }
    xdef->flags &= ~SYMF_LNKSYM;  /* do not init again */
  }
}

// Assembly:
testb $0x1, 0x41(%rsi)
je 0x15963
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x48(%rsi), %eax
cmpq $0x6, %rax
ja 0x15958
movq %rdi, %r14
leaq 0xdae0(%rip), %rcx      # 0x23370
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xcd01(%rip), %rsi      # 0x225a1
movq %r14, %rdi
movl $0x2, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbe13
testq %rax, %rax
jne 0x15950
leaq 0xcce3(%rip), %rsi      # 0x225a8
jmp 0x1590a
leaq 0xccfd(%rip), %rsi      # 0x225cb
jmp 0x15935
leaq 0xcce6(%rip), %rsi      # 0x225bd
jmp 0x15935
leaq 0xcce4(%rip), %rsi      # 0x225c4
jmp 0x15935
leaq 0xccc5(%rip), %rsi      # 0x225ae
movq %r14, %rdi
movl $0x2, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbe13
testq %rax, %rax
jne 0x15950
leaq 0xccac(%rip), %rsi      # 0x225b6
movq %r14, %rdi
movl $0x3, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbe13
testq %rax, %rax
jne 0x15950
movq %r14, %rdi
callq 0xc9b2
jmp 0x15950
leaq 0xcc9b(%rip), %rsi      # 0x225d0
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbe13
testq %rax, %rax
je 0x15958
movb $0x2, 0x40(%rbx)
movq 0x60(%rax), %rax
movq %rax, 0x38(%rbx)
andb $-0x2, 0x41(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xda63(%rip), %rsi      # 0x233ce
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbe13
testq %rax, %rax
je 0x15958
movq 0x40(%rax), %rax
movq %rax, 0x30(%rbx)
jmp 0x15958