ia64/xen-unstable

changeset 13946:796887cef9e1

[XEN][POWERPC] Update linker symbols and scripts

The following patch:
- updates linker symbols and interfaces that use them
- clean up of dynamically registered PAPR hcalls
- Way simpler linker script

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Wed Jan 17 14:12:08 2007 -0500 (2007-01-17)
parents 978ff6fad81f
children 7242b912d266
files xen/arch/powerpc/Makefile xen/arch/powerpc/boot_of.c xen/arch/powerpc/hcalls.c xen/arch/powerpc/of-devtree.h xen/arch/powerpc/xen.lds.S xen/include/asm-powerpc/config.h xen/include/asm-powerpc/init.h
line diff
     1.1 --- a/xen/arch/powerpc/Makefile	Tue Feb 06 15:03:52 2007 -0600
     1.2 +++ b/xen/arch/powerpc/Makefile	Wed Jan 17 14:12:08 2007 -0500
     1.3 @@ -64,7 +64,7 @@ CFLAGS += $(PPC_C_WARNINGS)
     1.4  # objects into a single ELF segment and to not link in any additional
     1.5  # objects that gcc would normally like to
     1.6  #
     1.7 -OMAGIC = -N -nodefaultlibs -nostartfiles
     1.8 +OMAGIC = -nodefaultlibs -nostartfiles
     1.9  
    1.10  firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
    1.11  	$(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
     2.1 --- a/xen/arch/powerpc/boot_of.c	Tue Feb 06 15:03:52 2007 -0600
     2.2 +++ b/xen/arch/powerpc/boot_of.c	Wed Jan 17 14:12:08 2007 -0500
     2.3 @@ -13,7 +13,7 @@
     2.4   * along with this program; if not, write to the Free Software
     2.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     2.6   *
     2.7 - * Copyright (C) IBM Corp. 2005, 2006
     2.8 + * Copyright IBM Corp. 2005, 2006, 2007
     2.9   *
    2.10   * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    2.11   *          Hollis Blanchard <hollisb@us.ibm.com>
    2.12 @@ -1341,7 +1341,7 @@ multiboot_info_t __init *boot_of_init(
    2.13              __func__,
    2.14              r3, r4, vec, r6, r7, orig_msr);
    2.15  
    2.16 -    if ((vec >= (ulong)_start) && (vec <= (ulong)_end)) {
    2.17 +    if (is_kernel(vec)) {
    2.18          of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image "
    2.19                  "that ranges: %p .. %p.\n",
    2.20                  vec, _start, _end);
     3.1 --- a/xen/arch/powerpc/hcalls.c	Tue Feb 06 15:03:52 2007 -0600
     3.2 +++ b/xen/arch/powerpc/hcalls.c	Wed Jan 17 14:12:08 2007 -0500
     3.3 @@ -13,7 +13,7 @@
     3.4   * along with this program; if not, write to the Free Software
     3.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     3.6   *
     3.7 - * Copyright (C) IBM Corp. 2005
     3.8 + * Copyright IBM Corp. 2005, 2006, 2007
     3.9   *
    3.10   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    3.11   */
    3.12 @@ -130,7 +130,7 @@ static void register_papr_hcall(ulong nu
    3.13  
    3.14  static void init_papr_hcalls(void)
    3.15  {
    3.16 -    inithcall_t *hcall;
    3.17 +    init_hcall_t *hcall;
    3.18      int i;
    3.19  
    3.20      /* initialize PAPR hcall table */
    3.21 @@ -140,7 +140,7 @@ static void init_papr_hcalls(void)
    3.22          register_papr_hcall(i, do_ni_papr_hypercall);
    3.23  
    3.24      /* register the PAPR hcalls */
    3.25 -    for (hcall = &__inithcall_start; hcall < &__inithcall_end; hcall++) {
    3.26 +    for (hcall = &__init_hcall_start; hcall < &__init_hcall_end; hcall++) {
    3.27          register_papr_hcall(hcall->number, hcall->handler);
    3.28      }
    3.29  }
     4.1 --- a/xen/arch/powerpc/of-devtree.h	Tue Feb 06 15:03:52 2007 -0600
     4.2 +++ b/xen/arch/powerpc/of-devtree.h	Wed Jan 17 14:12:08 2007 -0500
     4.3 @@ -13,7 +13,7 @@
     4.4   * along with this program; if not, write to the Free Software
     4.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     4.6   *
     4.7 - * Copyright (C) IBM Corp. 2005
     4.8 + * Copyright IBM Corp. 2005, 2006, 2007
     4.9   *
    4.10   * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    4.11   */
    4.12 @@ -23,6 +23,7 @@
    4.13  
    4.14  #include <xen/types.h>
    4.15  #include <xen/string.h>
    4.16 +#include <xen/kernel.h>
    4.17  #include <public/xen.h>
    4.18  
    4.19  enum {
     5.1 --- a/xen/arch/powerpc/xen.lds.S	Tue Feb 06 15:03:52 2007 -0600
     5.2 +++ b/xen/arch/powerpc/xen.lds.S	Wed Jan 17 14:12:08 2007 -0500
     5.3 @@ -7,202 +7,112 @@ OUTPUT_FORMAT("elf64-powerpc", "elf64-po
     5.4  	      "elf64-powerpc")
     5.5  OUTPUT_ARCH(powerpc:common64)
     5.6  ENTRY(_start)
     5.7 -SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
     5.8 -/* Do we need any of these for elf?
     5.9 -   __DYNAMIC = 0;    */
    5.10  PHDRS
    5.11  {
    5.12    text PT_LOAD;
    5.13  }   
    5.14  SECTIONS
    5.15  {
    5.16 +  /* This is the address that we are linking at */  	
    5.17    . = 0x00400000;
    5.18    PROVIDE(_text = .);
    5.19 +  PROVIDE(_stext = .);
    5.20    /* Read-only sections, merged into text segment: */
    5.21 -  .interp         : { *(.interp) } :text
    5.22 -  .hash           : { *(.hash) }
    5.23 -  .dynsym         : { *(.dynsym) }
    5.24 -  .dynstr         : { *(.dynstr) }
    5.25 -  .gnu.version    : { *(.gnu.version) }
    5.26 -  .gnu.version_d  : { *(.gnu.version_d) }
    5.27 -  .gnu.version_r  : { *(.gnu.version_r) }
    5.28 -  .rel.dyn        :
    5.29 -    {
    5.30 -      *(.rel.init)
    5.31 -      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
    5.32 -      *(.rel.fini)
    5.33 -      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
    5.34 -      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
    5.35 -      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
    5.36 -      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
    5.37 -      *(.rel.ctors)
    5.38 -      *(.rel.dtors)
    5.39 -      *(.rel.got)
    5.40 -      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
    5.41 -      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
    5.42 -      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
    5.43 -      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
    5.44 -      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
    5.45 -    }
    5.46 -  .rela.dyn       :
    5.47 -    {
    5.48 -      *(.rela.init)
    5.49 -      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
    5.50 -      *(.rela.fini)
    5.51 -      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
    5.52 -      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
    5.53 -      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
    5.54 -      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
    5.55 -      *(.rela.ctors)
    5.56 -      *(.rela.dtors)
    5.57 -      *(.rela.got)
    5.58 -      *(.rela.toc)
    5.59 -      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
    5.60 -      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
    5.61 -      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
    5.62 -      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
    5.63 -      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
    5.64 -    }
    5.65 -  .rel.plt        : { *(.rel.plt) }
    5.66 -  .rela.plt       : { *(.rela.plt) }
    5.67 -  .rela.tocbss	  : { *(.rela.tocbss) }
    5.68 -  .init           :
    5.69 -  {
    5.70 -    KEEP (*(.init))
    5.71 -  } =0x60000000
    5.72    .text           :
    5.73    {
    5.74 -    *(.text .stub .text.* .gnu.linkonce.t.*)
    5.75 +    *(.text)
    5.76      /* .gnu.warning sections are handled specially by elf32.em.  */
    5.77      *(.gnu.warning)
    5.78 -    *(.sfpr .glink)
    5.79 -  } =0x60000000
    5.80 -  .fini           :
    5.81 -  {
    5.82 -    KEEP (*(.fini))
    5.83 -  } =0x60000000
    5.84 +  } : text
    5.85 +  /* end of text */
    5.86    PROVIDE (__etext = .);
    5.87    PROVIDE (_etext = .);
    5.88    PROVIDE (etext = .);
    5.89 -  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
    5.90 -  .rodata1        : { *(.rodata1) }
    5.91 -  .sdata2         : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
    5.92 -  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
    5.93 -  .eh_frame_hdr : { *(.eh_frame_hdr) }
    5.94 -  /* Adjust the address for the data segment.  We want to adjust up to
    5.95 -     the same address within the page on the next page up.  */
    5.96 -  . = ALIGN (0x10000) - ((0x10000 - .) & (0x10000 - 1)); . = DATA_SEGMENT_ALIGN (0x10000, 0x1000);
    5.97 -  /* Ensure the __preinit_array_start label is properly aligned.  We
    5.98 -     could instead move the label definition inside the section, but
    5.99 -     the linker would then create the section even if it turns out to
   5.100 -     be empty, which isn't pretty.  */
   5.101 -  . = ALIGN(64 / 8);
   5.102 -  PROVIDE (__preinit_array_start = .);
   5.103 -  .preinit_array     : { *(.preinit_array) }
   5.104 -  PROVIDE (__preinit_array_end = .);
   5.105 -  PROVIDE (__init_array_start = .);
   5.106 -  .init_array     : { *(.init_array) }
   5.107 -  PROVIDE (__init_array_end = .);
   5.108 -  PROVIDE (__fini_array_start = .);
   5.109 -  .fini_array     : { *(.fini_array) }
   5.110 -  PROVIDE (__fini_array_end = .);
   5.111 +
   5.112 +  /* read only data */
   5.113 +  .rodata         : { *(.rodata .rodata.*) } : text
   5.114 +  .rodata1        : { *(.rodata1) } : text
   5.115 +  .sdata2         : { *(.sdata2 .sdata2.*) } : text
   5.116 +  .sbss2          : { *(.sbss2 .sbss2.*) } : text
   5.117 +
   5.118 +  . = ALIGN(64);
   5.119 +  __start___ex_table = .;
   5.120 +  __ex_table : { *(__ex_table) } : text
   5.121 +  __stop___ex_table = .;
   5.122 +  . = ALIGN(64);
   5.123 +
   5.124    .data           :
   5.125    {
   5.126      *(.data .gnu.linkonce.d.*)
   5.127      SORT(CONSTRUCTORS)
   5.128 -  }
   5.129 -
   5.130 -  . = ALIGN(32);
   5.131 -  __setup_start = .;
   5.132 -  .init.setup : { *(.init.setup) }
   5.133 -  __setup_end = .;
   5.134 -  __initcall_start = .;
   5.135 -  .initcall.init : { *(.initcall1.init) }
   5.136 -  __initcall_end = .;
   5.137 -  __inithcall_start = .;
   5.138 -  .inithcall.text : { *(.inithcall.text) }
   5.139 -  __inithcall_end = .;
   5.140 -
   5.141 -  __per_cpu_start = .;
   5.142 -  .data.percpu : { *(.data.percpu) }
   5.143 -  __per_cpu_data_end = .;
   5.144 -  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
   5.145 -  . = ALIGN(STACK_SIZE);
   5.146 -  __per_cpu_end = .;
   5.147 -
   5.148 -  .data1          : { *(.data1) }
   5.149 -  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
   5.150 -  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
   5.151 -  .eh_frame       : { KEEP (*(.eh_frame)) }
   5.152 -  .gcc_except_table   : { *(.gcc_except_table) }
   5.153 -  .toc1		 ALIGN(8) : { *(.toc1) }
   5.154 -  .opd		 ALIGN(8) : { KEEP (*(.opd)) }
   5.155 -  .dynamic        : { *(.dynamic) }
   5.156 -  .ctors          :
   5.157 -  {
   5.158 -    /* gcc uses crtbegin.o to find the start of
   5.159 -       the constructors, so we make sure it is
   5.160 -       first.  Because this is a wildcard, it
   5.161 -       doesn't matter if the user does not
   5.162 -       actually link against crtbegin.o; the
   5.163 -       linker won't look for a file to match a
   5.164 -       wildcard.  The wildcard also means that it
   5.165 -       doesn't matter which directory crtbegin.o
   5.166 -       is in.  */
   5.167 -    KEEP (*crtbegin*.o(.ctors))
   5.168 -    /* We don't want to include the .ctor section from
   5.169 -       from the crtend.o file until after the sorted ctors.
   5.170 -       The .ctor section from the crtend file contains the
   5.171 -       end of ctors marker and it must be last */
   5.172 -    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
   5.173 -    KEEP (*(SORT(.ctors.*)))
   5.174 -    KEEP (*(.ctors))
   5.175 -  }
   5.176 -  .dtors          :
   5.177 -  {
   5.178 -    KEEP (*crtbegin*.o(.dtors))
   5.179 -    KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
   5.180 -    KEEP (*(SORT(.dtors.*)))
   5.181 -    KEEP (*(.dtors))
   5.182 -  }
   5.183 -  .jcr            : { KEEP (*(.jcr)) }
   5.184 -  .got		ALIGN(8) : { *(.got .toc) }
   5.185 +  } : text
   5.186 +  .data1          : { *(.data1) } : text
   5.187 +  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) } : text
   5.188 +  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } : text
   5.189 +  .toc1		 ALIGN(8) : { *(.toc1) } : text
   5.190 +  .opd		 ALIGN(8) : { KEEP (*(.opd)) } : text
   5.191 +  .got		ALIGN(8) : { *(.got .toc) } : text
   5.192    /* We want the small data sections together, so single-instruction offsets
   5.193       can access them all, and initialized data all before uninitialized, so
   5.194       we can shorten the on-disk segment size.  */
   5.195    .sdata          :
   5.196    {
   5.197      *(.sdata .sdata.* .gnu.linkonce.s.*)
   5.198 -  }
   5.199 +  } : text
   5.200    _edata = .;
   5.201    PROVIDE (edata = .);
   5.202 +
   5.203 +  . = ALIGN(4096);		/* Init code and data */
   5.204 +  __init_begin = .;
   5.205 +  _sinittext = .;
   5.206 +  .init.text : { *(.init.text) } : text
   5.207 +  _einittext = .;
   5.208 +  .init.data : { *(.init.data) } : text
   5.209 +  . = ALIGN(32);
   5.210 +  __setup_start = .;
   5.211 +  .init.setup : { *(.init.setup) } : text
   5.212 +  __setup_end = .;
   5.213 +  __initcall_start = .;
   5.214 +  .initcall.init : { *(.initcall1.init) } : text
   5.215 +  __initcall_end = .;
   5.216 +  __init_hcall_start = .;
   5.217 +  .init_hcall.init : { *(.init_hcall.init) } : text
   5.218 +  __init_hcall_end = .;
   5.219 +  __builtin_cmdline : { *(__builtin_cmdline) } : text
   5.220 +  . = ALIGN(4096);
   5.221 +  __init_end = .;
   5.222 +	
   5.223 +  __per_cpu_start = .;
   5.224 +  .data.percpu : { *(.data.percpu) } :text
   5.225 +  __per_cpu_data_end = .;
   5.226 +  . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
   5.227 +  . = ALIGN(STACK_SIZE);
   5.228 +  __per_cpu_end = .;
   5.229 +	
   5.230    __bss_start = .;
   5.231 -  .tocbss	 ALIGN(8) : { *(.tocbss)}
   5.232 +  .tocbss	 ALIGN(8) : { *(.tocbss) } : text
   5.233    .sbss           :
   5.234    {
   5.235      PROVIDE (__sbss_start = .);
   5.236      PROVIDE (___sbss_start = .);
   5.237 -    *(.dynsbss)
   5.238      *(.sbss .sbss.* .gnu.linkonce.sb.*)
   5.239      *(.scommon)
   5.240      PROVIDE (__sbss_end = .);
   5.241      PROVIDE (___sbss_end = .);
   5.242 -  }
   5.243 -  .plt            : { *(.plt) }
   5.244 +  } : text
   5.245    .bss            :
   5.246    {
   5.247 -   *(.dynbss)
   5.248     *(.bss .bss.* .gnu.linkonce.b.*)
   5.249     *(COMMON)
   5.250     /* Align here to ensure that the .bss section occupies space up to
   5.251        _end.  Align after .bss to ensure correct alignment even if the
   5.252        .bss section disappears because there are no input sections.  */
   5.253     . = ALIGN(64 / 8);
   5.254 -  }
   5.255 +  } : text
   5.256    . = ALIGN(64 / 8);
   5.257    _end = .;
   5.258    PROVIDE (end = .);
   5.259 -  . = DATA_SEGMENT_END (.);
   5.260 +
   5.261    /* Stabs debugging sections.  */
   5.262    .stab          0 : { *(.stab) }
   5.263    .stabstr       0 : { *(.stabstr) }
     6.1 --- a/xen/include/asm-powerpc/config.h	Tue Feb 06 15:03:52 2007 -0600
     6.2 +++ b/xen/include/asm-powerpc/config.h	Wed Jan 17 14:12:08 2007 -0500
     6.3 @@ -13,7 +13,7 @@
     6.4   * along with this program; if not, write to the Free Software
     6.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     6.6   *
     6.7 - * Copyright (C) IBM Corp. 2005
     6.8 + * Copyright IBM Corp. 2005, 2006, 2007
     6.9   *
    6.10   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    6.11   */
    6.12 @@ -34,9 +34,6 @@
    6.13  
    6.14  #define U(x) (x ## U)
    6.15  #define UL(x) (x ## UL)
    6.16 -extern char _start[];
    6.17 -extern char _end[];
    6.18 -extern char _etext[];
    6.19  extern char __bss_start[];
    6.20  #endif
    6.21  
     7.1 --- a/xen/include/asm-powerpc/init.h	Tue Feb 06 15:03:52 2007 -0600
     7.2 +++ b/xen/include/asm-powerpc/init.h	Wed Jan 17 14:12:08 2007 -0500
     7.3 @@ -13,7 +13,7 @@
     7.4   * along with this program; if not, write to the Free Software
     7.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     7.6   *
     7.7 - * Copyright (C) IBM Corp. 2006
     7.8 + * Copyright IBM Corp. 2006, 2007
     7.9   *
    7.10   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
    7.11   */
    7.12 @@ -27,14 +27,14 @@ typedef void (*hcall_handler_t)(struct c
    7.13  typedef struct {
    7.14      unsigned long number;
    7.15      hcall_handler_t handler;
    7.16 -} inithcall_t;
    7.17 -extern inithcall_t __inithcall_start, __inithcall_end;
    7.18 +} init_hcall_t;
    7.19 +extern init_hcall_t __init_hcall_start, __init_hcall_end;
    7.20  
    7.21  #define __init_papr_hcall(nr, fn) \
    7.22 -    static inithcall_t __inithcall_##fn __init_hcall \
    7.23 +    static init_hcall_t __init_hcall_##fn __init_hcall \
    7.24      = { .number = nr, .handler = fn }
    7.25  
    7.26  #define __init_hcall  \
    7.27 -    __attribute_used__ __attribute__ ((__section__ (".inithcall.text")))
    7.28 +    __attribute_used__ __attribute__ ((__section__ (".init_hcall.init")))
    7.29  
    7.30  #endif /* _XEN_ASM_INIT_H */