Home | History | Annotate | Download | only in Scripts
      1 /** @file
      2 
      3   Unified linker script for GCC based builds
      4 
      5   Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
      6   Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
      7 
      8   This program and the accompanying materials are licensed and made available under
      9   the terms and conditions of the BSD License that accompanies this distribution.
     10   The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php.
     12 
     13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 
     16 **/
     17 
     18 SECTIONS {
     19 
     20   /*
     21    * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
     22    * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
     23    * between 32-bit and 64-bit builds). The actual start of the .text section
     24    * will be rounded up based on its actual alignment.
     25    */
     26   . = PECOFF_HEADER_SIZE;
     27 
     28   .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
     29     *(.text .text.* .stub .gnu.linkonce.t.*)
     30     *(.rodata .rodata.* .gnu.linkonce.r.*)
     31     *(.got .got.*)
     32 
     33     /*
     34      * The contents of AutoGen.c files are constant from the POV of the program,
     35      * but most of its contents end up in .data or .bss by default since few of
     36      * the variable definitions that get emitted are declared as CONST.
     37      */
     38     *:AutoGen.obj(.data .data.* .bss .bss.*)
     39   }
     40 
     41   /*
     42    * The alignment of the .data section should be less than or equal to the
     43    * alignment of the .text section. This ensures that the relative offset
     44    * between these sections is the same in the ELF and the PE/COFF versions of
     45    * this binary.
     46    */
     47   .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
     48     *(.data .data.* .gnu.linkonce.d.*)
     49     *(.bss .bss.*)
     50   }
     51 
     52   .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
     53     KEEP (*(.eh_frame))
     54   }
     55 
     56   .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : {
     57     *(.rela .rela.*)
     58   }
     59 
     60   /DISCARD/ : {
     61     *(.note.GNU-stack)
     62     *(.gnu_debuglink)
     63     *(.interp)
     64     *(.dynsym)
     65     *(.dynstr)
     66     *(.dynamic)
     67     *(.hash)
     68     *(.comment)
     69     *(COMMON)
     70   }
     71 }
     72