// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x41(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2240f
movq 0x18(%rsp), %rax
movl 0x48(%rax), %eax
movq %rax, 0x8(%rsp)
subq $0x6, %rax
ja 0x22400
movq 0x8(%rsp), %rax
leaq 0x14016(%rip), %rcx     # 0x361bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rdi
leaq 0x133f6(%rip), %rsi     # 0x355b1
movl $0x2, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
jne 0x22214
movq 0x20(%rsp), %rdi
leaq 0x133d3(%rip), %rsi     # 0x355b8
movl $0x3, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
jne 0x22212
movq 0x20(%rsp), %rdi
callq 0x132b0
movq %rax, 0x10(%rsp)
jmp 0x22214
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x13387(%rip), %rsi     # 0x355be
movl $0x2, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
jne 0x22290
movq 0x20(%rsp), %rdi
leaq 0x13365(%rip), %rsi     # 0x355c6
movl $0x3, %edx
xorl %r9d, %r9d
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
jne 0x2228e
movq 0x20(%rsp), %rdi
callq 0x132b0
movq %rax, 0x10(%rsp)
jmp 0x22290
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x1331a(%rip), %rsi     # 0x355cd
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x222ea
movq 0x18(%rsp), %rax
movb $0x2, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x132d9(%rip), %rsi     # 0x355d4
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x22332
movq 0x18(%rsp), %rax
movb $0x2, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x13298(%rip), %rsi     # 0x355db
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x2237a
movq 0x18(%rsp), %rax
movb $0x2, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x13255(%rip), %rsi     # 0x355e0
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x223c2
movq 0x18(%rsp), %rax
movb $0x2, 0x40(%rax)
movq 0x10(%rsp), %rax
movq 0x60(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x38(%rax)
jmp 0x22400
movq 0x20(%rsp), %rdi
leaq 0x13e72(%rip), %rsi     # 0x36242
xorl %r9d, %r9d
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x12110
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0x223fe
movq 0x10(%rsp), %rax
movq 0x40(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x30(%rax)
jmp 0x22400
movq 0x18(%rsp), %rax
movzbl 0x41(%rax), %ecx
andl $-0x2, %ecx
movb %cl, 0x41(%rax)
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)