OUTPUT_FORMAT(elf64-x86-64)

ENTRY(_start)

PHDRS {
  text PT_LOAD;
  rodata PT_LOAD;
  data PT_LOAD;
  bss PT_LOAD;
  tls PT_TLS;
}

SECTIONS {
  . = 0x0000500000000000;

  .text : {
    *(.text .text.*)
    *(.ltext .ltext.*)
  } :text
  
  . = ALIGN(0x1000);
  
  .rodata : {
    *(.rodata .rodata.*)
  } :rodata

  . = ALIGN(0x1000);

  .data : {
    *(.data .data.*)
    *(.ldata .ldata.*)
  } :data
   
  . = ALIGN(0x1000);

  __bss_start = .;

  .bss : {
    *(.bss .bss.*)
    *(.lbss .lbss.*)
  } :bss

  __bss_end = .;
  
  . = ALIGN(0x1000);

  __tdata_start = .;

  .tdata : {
    *(.tdata .tdata.*)
  } :tls
  
  __tdata_end = .;
  
  __tbss_start = .;

  .tbss : {
    *(.tbss .tbss.*)
  } :tls
  
  __tbss_end = .;
  
  __tls_size = __tbss_end - __tdata_start;

  /DISCARD/ : {
    *(.eh_frame*)
    *(.note .note.*)
  }
}
