// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/ldscript.c
// Function: symbol_assignment
static void symbol_assignment(struct GlobalVars *gv,
                              char *symname,uint8_t symflags)
{
  char *fn = "symbol_assignment(): ";
  struct LinkedSection *cls = current_ls;
  struct MemoryDescr *md = cls ? cls->relocmem : vdefmem;
  struct Symbol *sym;
  lword expr_val;

  if (!strcmp(symname,".")) {
    if (level >= 1) {
      if (!preparse) {
        if (!(symflags & SYMF_PROVIDED)) {
          parse_expr(md->current,&expr_val);
          change_address(md,expr_val);
        }
        else {
          /* Address symbol '.' cannot be provided */
          error(108,scriptname,getlineno());
        }
      }
    }
    else {
      /* Address symbol '.' invalid outside SECTIONS block */
      error(101,scriptname,getlineno());
    }
  }

  else {
    /* real symbol assignment */

    if (level < 1) {
      if (preparse) {   /* level 0 (outside SECTION) is only parsed once! */
        if (parse_expr(-1,&expr_val)) {
          scriptsymbol(gv,symname,expr_val,SYM_ABS,symflags);
        }
        else {
          /* Only absolute expr. may be assigned outside SECTIONS block */
          error(110,scriptname,getlineno());
        }
      }
    }

    else {
      if (preparse) {
        scriptsymbol(gv,symname,0,SYM_ABS,symflags);
      }
      else {
        if (sym = findsymbol(gv,NULL,symname)) {
          int abs = parse_expr(md->current,&expr_val);

          if (level < 2)
            abs = 1;
          sym->type = abs ? SYM_ABS : SYM_RELOC;
          if (!abs) {
            if (current_ls) {
              /* assign section and remove from scriptsymbol list,
                 will be moved into section's symbol list in linker_copy() */
              if (listempty(&current_ls->sections)) {
                sym->relsect = get_dummy_sec(current_ls->name);
                /* a section with symbols must be allocated? @@@ */
                current_ls->flags |= SF_ALLOC;
              }
              else
                sym->relsect = (struct Section *)current_ls->sections.first;
              remnode(&sym->n);
            }
            else
              ierror("%sNo current LinkedSection set, while "
                     "defining %s",fn,symname);
          }
          sym->value = abs ? expr_val : (expr_val - current_ls->base);
        }
        else
          ierror("%s%s disappeared",fn,symname);
      }
    }
  }

  skip_expr(symflags&SYMF_PROVIDED);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq 0x26000(%rip), %rax     # 0x339f8
leaq 0x30(%rax), %rcx
testq %rax, %rax
leaq 0x26022(%rip), %rax     # 0x33a28
cmovneq %rcx, %rax
movq %rdi, %r14
movq (%rax), %r12
cmpb $0x2e, (%rsi)
jne 0xda20
cmpb $0x0, 0x1(%r15)
je 0xdae0
cmpl $0x0, 0x25fe5(%rip)     # 0x33a0c
movb 0x26023(%rip), %al      # 0x33a50
jle 0xda40
testb $0x1, %al
je 0xda72
movzbl %bl, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
jmp 0xda68
testb $0x1, %al
je 0xdc07
pushq $-0x1
popq %rdi
movq %rsp, %rsi
callq 0xf5a5
testl %eax, %eax
je 0xdb55
movq (%rsp), %rdx
movzbl %bl, %ecx
movq %r14, %rdi
movq %r15, %rsi
callq 0xf14f
jmp 0xdc07
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xa220
testq %rax, %rax
je 0xdb1f
movq %rax, %r14
movq 0x20(%r12), %rdi
movq %rsp, %rsi
callq 0xf5a5
cmpl $0x2, 0x25f6d(%rip)     # 0x33a0c
setge %cl
testl %eax, %eax
sete %al
andb %cl, %al
leal 0x1(%rax), %ecx
movb %cl, 0x40(%r14)
testb %al, %al
je 0xdb3c
movq 0x25f39(%rip), %r12     # 0x339f8
testq %r12, %r12
je 0xdb65
movq 0x60(%r12), %rax
cmpq $0x0, (%rax)
je 0xdb9c
movq %rax, 0x38(%r14)
jmp 0xdbec
cmpl $0x0, 0x25f25(%rip)     # 0x33a0c
jle 0xdb45
cmpb $0x0, 0x25f60(%rip)     # 0x33a50
jne 0xdc07
testb $0x8, %bl
jne 0xdb7f
movq 0x20(%r12), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0xf5a5
movq (%r14), %rsi
movq %r12, %rdi
callq 0xe2bb
jmp 0xdc07
leaq 0x13148(%rip), %rdi     # 0x20c6e
leaq 0x130f9(%rip), %rsi     # 0x20c26
movq %r15, %rdx
xorl %eax, %eax
callq 0x6b2c
jmp 0xdc07
movq (%rsp), %rax
jmp 0xdc03
movq 0x25ec4(%rip), %r14     # 0x33a10
callq 0xf90a
pushq $0x65
jmp 0xdb8d
movq 0x25eb4(%rip), %r14     # 0x33a10
callq 0xf90a
pushq $0x6e
jmp 0xdb8d
leaq 0x130d0(%rip), %rdi     # 0x20c3c
leaq 0x130b3(%rip), %rsi     # 0x20c26
movq %r15, %rdx
xorl %eax, %eax
callq 0x6b2c
jmp 0xdbf4
movq 0x25e8a(%rip), %r14     # 0x33a10
callq 0xf90a
pushq $0x6c
popq %rdi
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
jmp 0xdc07
movq 0x18(%r12), %r15
movq 0x25eb8(%rip), %rax     # 0x33a60
movq 0x20(%rax), %rbp
movq %rbp, %r13
movq (%rbp), %rbp
testq %rbp, %rbp
je 0xdbca
movq 0x20(%r13), %rdi
movq %r15, %rsi
callq 0x5160
testl %eax, %eax
jne 0xdbac
jmp 0xdbe2
leaq 0x130ae(%rip), %rdi     # 0x20c7f
movq %r15, %rsi
xorl %eax, %eax
callq 0x6b2c
movq 0x25e16(%rip), %r12     # 0x339f8
movq %r13, 0x38(%r14)
orb $0x1, 0x21(%r12)
movq %r14, %rdi
callq 0x6444
movq (%rsp), %rax
movq 0x25df9(%rip), %rcx     # 0x339f8
subq 0x40(%rcx), %rax
movq %rax, 0x30(%r14)
andb $0x8, %bl
movzbl %bl, %edi
callq 0xd1da
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq