// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32.c
// Function: elf32_initdynlink
void elf32_initdynlink(struct GlobalVars *gv)
{
  struct ObjectUnit *ou = gv->dynobj;
  struct Symbol *sym;

  /* set endianess for output file */
  elf32_endianess = fff[gv->dest_format]->endianess;

  /* init dynamic symbol list */
  initlist(&dynsym_list);

  /* allocate .interp section for dynamically linked executables only */
  if (!gv->dest_sharedobj)
    add_section(ou,".interp",(uint8_t *)gv->interp_path,
                strlen(gv->interp_path)+1,ST_DATA,SF_ALLOC,SP_READ,0,TRUE);

  /* .hash, .dynsym, .dynstr and .dynamic are always present.
     Set them to an initial size. They will grow with dynamic symbols added. */
  add_section(ou,hash_name,NULL,0,ST_DATA,SF_ALLOC,SP_READ,2,TRUE);
  add_section(ou,dynsym_name,NULL,0,ST_DATA,SF_ALLOC,SP_READ,2,TRUE);
  add_section(ou,dynstr_name,NULL,0,ST_DATA,SF_ALLOC,SP_READ,0,TRUE);
  dynamic = add_section(ou,dyn_name,NULL,0,ST_DATA,SF_ALLOC,
                        SP_READ|SP_WRITE,2,TRUE);

  /* assign symbol _DYNAMIC the address of the .dynamic section */
  sym = elf32_makelnksym(gv,DYNAMICSYM);
  sym->flags |= SYMF_DYNEXPORT;
  elf32_adddynsym(sym);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq 0x1e0(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rax
movzbl 0x50(%rax), %eax
movl %eax, %ecx
leaq 0x1d5e4(%rip), %rax     # 0x3fa30
movq (%rax,%rcx,8), %rax
movb 0xaa(%rax), %al
movb %al, 0x1de74(%rip)      # 0x402d0
leaq 0x2282d(%rip), %rdi     # 0x44c90
callq 0x7330
movq 0x40(%rsp), %rax
cmpl $0x0, 0x58(%rax)
jne 0x224e1
movq 0x38(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq 0xe8(%rax), %rdi
callq 0x50c0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq %rax, %rcx
addq $0x1, %rcx
leaq 0x13827(%rip), %rsi     # 0x35cde
movl $0x2, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq 0x38(%rsp), %rdi
leaq 0x13d5e(%rip), %rsi     # 0x3624b
xorl %eax, %eax
movl %eax, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %rcx, %rdx
movl $0x1, (%rsp)
movl $0x2, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq 0x38(%rsp), %rdi
leaq 0x13d29(%rip), %rsi     # 0x36251
xorl %eax, %eax
movl %eax, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %rcx, %rdx
movl $0x1, (%rsp)
movl $0x2, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq 0x38(%rsp), %rdi
leaq 0x13cf6(%rip), %rsi     # 0x36259
xorl %eax, %eax
movl %eax, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movq %rcx, %rdx
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq 0x38(%rsp), %rdi
leaq 0x13ca2(%rip), %rsi     # 0x36242
xorl %eax, %eax
movl %eax, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
movq %rcx, %rdx
movl $0x3, (%rsp)
movl $0x2, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
callq 0x12660
movq %rax, 0x226d2(%rip)     # 0x44ca8
movq 0x40(%rsp), %rdi
movl $0x6, %esi
callq 0x22040
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movzbl 0x41(%rax), %ecx
orl $0x80, %ecx
movb %cl, 0x41(%rax)
movq 0x30(%rsp), %rdi
callq 0x22610
addq $0x48, %rsp
retq
nopl (%rax,%rax)