Subject: link_set_... sections and objcopy
To: None <thorpej@netbsd.org, port-arm@netbsd.org>
From: Richard Earnshaw <Richard.Earnshaw@arm.com>
List: port-arm
Date: 04/27/2004 19:28:03
Yet again I've been bitten by the objcopy bug that causes the a.out
version of the kernel image to have the .data and .bss sections at the
wrong vma.

Can you think of any reason (other than the fact that it make the script
more complex) why we can't just work around the problem by using the
following in link scripts for affected platforms?

I've tried this on my shark and it seems to be OK.  Now instead of
having multiple sections that objcopy can't really handle, there are
just the normal 3 (.text, .data, and .bss).

R.

  /* Read-only sections, merged into text segment: */
  .text :
  {
    *(.text)
    *(.text.*)
    *(.stub)
    *(.glue_7t) *(.glue_7)
    *(.rodata) *(.rodata.*)
    /* Special kernel data tables: we put these directly into .text
       because objcopy can't handle them properly in a.out format.  */
    . = ALIGN(4);
    PROVIDE (__start_link_set_pools = .);
    *(link_set_pools)
    PROVIDE (__stop_link_set_pools = .);
    . = ALIGN(4);
    PROVIDE (__start_link_set_sysctl_funcs = .);
    *(link_set_sysctl_funcs)
    PROVIDE (__stop_link_set_sysctl_funcs = .);
    . = ALIGN(4);
    PROVIDE (__start_link_set_malloc_types = .);
    *(link_set_malloc_types)
    PROVIDE (__stop_link_set_malloc_types = .);
    . = ALIGN(4);
    PROVIDE (__start_link_set_evcnts = .);
    *(link_set_evcnts)
    PROVIDE (__stop_link_set_evcnts = .);
  } =0
...