/*
 * Copyright (c) 2013-2019 TRUSTONIC LIMITED
 * All rights reserved
 *
 * The present software is the confidential and proprietary information of
 * TRUSTONIC LIMITED. You shall not disclose the present software and shall
 * use it only in accordance with the terms of the license agreement you
 * entered into with TRUSTONIC LIMITED. This software may be subject to
 * export or import laws in certain countries.
 */

ENTRY(_tlEntry)

PHDRS
{
   phdr1  PT_LOAD FLAGS(0x80000007);
}


SECTIONS
{
   . = 0x1000;

   .text :
   {
      KEEP(*(stext))
      KEEP(*(relocInfo))
      *(.text)
      *(.text.*)
      *(.init)
      *(.conststring)
      *(text)
      *(.rodata .rodata.* .gnu.linkonce.r.*) *(.constdata)
      /* Crypto library table magic.  Archive members contribute table entries
       * to sections `.autotable.TABLE.NN', capturing the bounds by placing
       * symbols in `.00' and `.99'.
       */
      KEEP (*(SORT_BY_NAME(.autotable.*)))

      /* Crypto library package-management magic.  It doesn't seem possible to
       * require a sybmol to be defined (causing a link error if it's not)
       * without using space in the final output.  To mitigate this, we place
       * the requiring relocation in a `comdat' section, but that engages the
       * linker's garbage collection which suppresses the error unless we say
       * otherwise here.
       */
      KEEP (*(.feature-require.*))

      /* Static constructor table. */
      /* Enforce __init_array_start symbol alignment for pointers */
      . = ALIGN(8);
      __init_array_start = .;
      KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)
            SORT_BY_INIT_PRIORITY(.ctors.*)))
      KEEP (*(.init_array .ctors))
      __init_array_end = .;
      *(.got*)
      *(.data.rel.ro)
      . = ALIGN(8);
      _etext = .;
   } :phdr1


   __reldyn_start = .;
   .rel.dyn :
   {
       *(.rel.dyn)
   }
   .rela.dyn :
   {
       *(.rela.dyn)
   }
   __reldyn_end = .;

   /*In the virtual address space we leave one page unused between code and data*/
   . = . + 0x1000;
   .data ALIGN(0x1000):
   {
      _sdata = .;
      KEEP(*(taProp))
      *(.data .data.* .gnu.linkonce.d.*)
      *(.data.rel*)
      . = ALIGN(8);
      _edata = .;
      . = ALIGN(16);
   }

   .bss :
   {
      _sbss = .;
      *(COMMON)
      *(stack)
      *(heap)
      *(.bss.*)
      *(.bss)
      *(.tci)
      . = ALIGN(8);
      _ebss = .;
   }

   .interp :
   {
      *(.interp*)
   }


   .dynamic :
   {
      *(.dynamic*)
   }

   .dynsym :
   {
      *(.dynsym)
   }

   .dynstr :
   {
      *(.dynstr)
   }

   .hash :
   {
      *(.hash)
   }

   .gnu.hash :
   {
      *(.gnu.hash)
   }

   .ARM.exidx :
   {
      *(.ARM.exidx*)
   }

   /DISCARD/ :
   {
      *(.plt) /* used for symbolic dynamic linking, not supported */
      *(.ARM.attributes)
      *(.arm_vfe_header)
      *(.note.gnu.build-id)
      *(.note.gnu.gold-version)
   }
}
