public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] libgloss: pru: Remove sim ld script
@ 2021-06-09 18:16 Jeff Johnston
  0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2021-06-09 18:16 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=df0ad84e91a77ea86438052fba0c76422cec4f5b

commit df0ad84e91a77ea86438052fba0c76422cec4f5b
Author: Dimitar Dimitrov <dimitar@dinux.eu>
Date:   Wed Mar 3 11:24:50 2021 +0200

    libgloss: pru: Remove sim ld script
    
    Binutils LD default linker script was recently fixed to allow memory
    sizes to be set via command line. Use this feature to remove the special
    sim linker script in libgloss.
    
    It is acceptable to require newer Binutils version here because simulator
    target is only used for regression testing the toolchain. Real HW
    targets are not affected.
    
    Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

Diff:
---
 libgloss/pru/Makefile.in                 |  10 +-
 libgloss/pru/device-specs/sim            |   2 +-
 libgloss/pru/ldscripts/gen-ld-scripts.sh |  80 -------------
 libgloss/pru/ldscripts/pruelf-sim.x      | 200 -------------------------------
 4 files changed, 3 insertions(+), 289 deletions(-)

diff --git a/libgloss/pru/Makefile.in b/libgloss/pru/Makefile.in
index 7fdbc0cb5..062c9e5cf 100644
--- a/libgloss/pru/Makefile.in
+++ b/libgloss/pru/Makefile.in
@@ -64,9 +64,6 @@ RANLIB = @RANLIB@
 OBJDUMP = `t='$(program_transform_name)'; echo objdump | sed -e $$t`
 OBJCOPY = `t='$(program_transform_name)'; echo objcopy | sed -e $$t`
 
-# linker scripts
-SCRIPTS = `ls ${srcdir}/ldscripts/*.x`
-
 # object files needed
 OBJS = \
 	do_global_dtors.o gettimeofday.o \
@@ -101,10 +98,7 @@ LDFLAGS_FOR_TARGET = ${MULTILIB}
 .S.o:
 	$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
 
-all: ${OUTPUTS} copy_scripts_to_objdir
-
-copy_scripts_to_objdir: $(srcdir)/ldscripts/gen-ld-scripts.sh
-	cp $(SCRIPTS) $(objdir)
+all: ${OUTPUTS}
 
 #
 # here's where we build the library for each target
@@ -130,7 +124,7 @@ distclean maintainer-clean realclean: clean
 	rm -f Makefile config.status $(OUTPUTS)
 
 .PHONY: install info install-info clean-info
-install: $(OUTPUTS) $(srcdir)/ldscripts/gen-ld-scripts.sh
+install: $(OUTPUTS)
 	for outputs in ${OUTPUTS}; do\
 	 ${INSTALL_DATA} $${outputs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}/$${outputs}; \
 	done
diff --git a/libgloss/pru/device-specs/sim b/libgloss/pru/device-specs/sim
index 50d4689e0..049e277aa 100644
--- a/libgloss/pru/device-specs/sim
+++ b/libgloss/pru/device-specs/sim
@@ -2,4 +2,4 @@
 -D__SIM__
 
 *link_device:
-%{!r:-Tpruelf-sim.x}
+%{!r:--defsym=__IMEM_SIZE=0x40000 --defsym=__DMEM_SIZE=0x4000000 --defsym=__HEAP_SIZE=0x2000000 --defsym=__STACK_SIZE=0x100000}
diff --git a/libgloss/pru/ldscripts/gen-ld-scripts.sh b/libgloss/pru/ldscripts/gen-ld-scripts.sh
deleted file mode 100755
index ddaf75a7a..000000000
--- a/libgloss/pru/ldscripts/gen-ld-scripts.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
-#
-# Copyright 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-# Generate additional MCU-specific linker scripts by using the
-# default PRU-LD linker script.
-#
-# We do it automatically so that:
-#  1. We only change the default linker script in binutils.
-#  2. All the default script complexity stays in binutils.
-#  3. Here in libgloss we only bump the memory sizes to
-#     allow large test programs to be executed.
-
-dump_modified()
-{
-  IMEM_SIZE=$1
-  DMEM_SIZE=$2
-  HEAP_SIZE=$3
-  STACK_SIZE=$4
-
-  echo "/* WARNING: automatically generated from the default pru-ld script! */"
-  echo -e "\n\n"
-  pru-ld --verbose | awk "
-BEGIN { LDV_MARKER = 0; }
-{
-  if (\$0 == \"==================================================\" )
-    {
-      LDV_MARKER++;
-    }
-  else if (LDV_MARKER != 1)
-    {
-    }
-  else if (\$0 ~ /^  imem.*ORIGIN =.*LENGTH =/)
-    {
-      print \"  imem   (x)   : ORIGIN = 0x20000000, LENGTH = $IMEM_SIZE\"
-    }
-  else if (\$0 ~ /^  dmem.*ORIGIN =.*LENGTH =/)
-    {
-      print \"  dmem   (rw!x) : ORIGIN = 0x0, LENGTH = $DMEM_SIZE\"
-    }
-  else if (\$0 ~ /^__HEAP_SIZE = DEFINED/)
-    {
-      print \"__HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : $HEAP_SIZE ;\";
-    }
-  else if (\$0 ~ /^__STACK_SIZE = DEFINED/)
-    {
-      print \"__STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : $STACK_SIZE ;\";
-    }
-  else
-    {
-      print \$0;
-    }
-}"
-}
-
-#             IMEM DMEM   HEAP_SIZE    STACK_SIZE
-dump_modified 256K 65536K "32 * 1024 * 1024" "1024 * 1024" | tee pruelf-sim.x
diff --git a/libgloss/pru/ldscripts/pruelf-sim.x b/libgloss/pru/ldscripts/pruelf-sim.x
deleted file mode 100644
index 1dc8b4f2e..000000000
--- a/libgloss/pru/ldscripts/pruelf-sim.x
+++ /dev/null
@@ -1,200 +0,0 @@
-/* WARNING: automatically generated from the default pru-ld script! */
-
-
-
-/* Default linker script, for normal executables */
-OUTPUT_FORMAT("elf32-pru","elf32-pru","elf32-pru")
-OUTPUT_ARCH(pru)
-MEMORY
-{
-  imem   (x)   : ORIGIN = 0x20000000, LENGTH = 256K
-  dmem   (rw!x) : ORIGIN = 0x0, LENGTH = 65536K
-}
-__HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32 * 1024 * 1024 ;
-__STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 1024 * 1024 ;
-PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem));
-ENTRY (_start)
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  .hash          : { *(.hash)		}
-  .dynsym        : { *(.dynsym)		}
-  .dynstr        : { *(.dynstr)		}
-  .gnu.version   : { *(.gnu.version)	}
-  .gnu.version_d   : { *(.gnu.version_d)	}
-  .gnu.version_r   : { *(.gnu.version_r)	}
-  .rel.init      : { *(.rel.init)		}
-  .rela.init     : { *(.rela.init)	}
-  .rel.text      :
-    {
-      *(.rel.text)
-      *(.rel.text.*)
-      *(.rel.text:*)
-      *(.rel.gnu.linkonce.t*)
-    }
-  .rela.text     :
-    {
-      *(.rela.text)
-      *(.rela.text.*)
-      *(.rela.text:*)
-      *(.rela.gnu.linkonce.t*)
-    }
-  .rel.fini      : { *(.rel.fini)		}
-  .rela.fini     : { *(.rela.fini)	}
-  .rel.rodata    :
-    {
-      *(.rel.rodata)
-      *(.rel.rodata.*)
-      *(.rel.rodata:*)
-      *(.rel.gnu.linkonce.r*)
-    }
-  .rela.rodata   :
-    {
-      *(.rela.rodata)
-      *(.rela.rodata.*)
-      *(.rela.rodata:*)
-      *(.rela.gnu.linkonce.r*)
-    }
-  .rel.data      :
-    {
-      *(.rel.data)
-      *(.rel.data.*)
-      *(.rel.data:*)
-      *(.rel.gnu.linkonce.d*)
-    }
-  .rela.data     :
-    {
-      *(.rela.data)
-      *(.rela.data.*)
-      *(.rela.data:*)
-      *(.rela.gnu.linkonce.d*)
-    }
-  .rel.init_array   	  : { *(.rel.init_array)	}
-  .rela.init_array  	  : { *(.rela.init_array)	}
-  .rel.fini_array   	  : { *(.rel.fini_array)	}
-  .rela.fini_array  	  : { *(.rela.fini_array)	}
-  .rel.got     		  : { *(.rel.got)		}
-  .rela.got    		  : { *(.rela.got)	}
-  .rel.bss     		  : { *(.rel.bss)		}
-  .rela.bss    		  : { *(.rela.bss)	}
-  .rel.plt     		  : { *(.rel.plt)		}
-  .rela.plt    		  : { *(.rela.plt)	}
-  /* Internal text space.  */
-  .text   :
-  {
-     _text_start = . ;
-    . = ALIGN(4);
-    *(.init0)  /* Start here after reset.  */
-    KEEP (*(.init0))
-    . = ALIGN(4);
-    *(.text)
-    . = ALIGN(4);
-    *(.text.*)
-    . = ALIGN(4);
-    *(.text:*)
-    . = ALIGN(4);
-    *(.gnu.linkonce.t*)
-    . = ALIGN(4);
-     _text_end = . ;
-  }  > imem
-  .data          :
-  {
-    /* Optional variable that user is prepared to have NULL address.  */
-     *(.data.atzero*)
-    /* CRT is prepared for constructor/destructor table to have
-       a "valid" NULL address.  */
-     __init_array_start = . ;
-     KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
-     KEEP (*(.init_array))
-     __init_array_end = . ;
-     __fini_array_start = . ;
-     KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
-     KEEP (*(.fini_array))
-     __fini_array_end = . ;
-    /* DATA memory starts at address 0.  So to avoid placing a valid static
-       variable at the invalid NULL address, we introduce the .data.atzero
-       section.  If CRT can make some use of it - great.  Otherwise skip a
-       word.  In all cases .data/.bss sections must start at non-zero.  */
-    . += (. == 0 ? 4 : 0);
-     PROVIDE (_data_start = .) ;
-    *(.data)
-     *(.data*)
-     *(.data:*)
-     *(.rodata)  /* We need to include .rodata here if gcc is used.  */
-     *(.rodata.*) /* with -fdata-sections.  */
-     *(.rodata:*)
-    *(.gnu.linkonce.d*)
-    *(.gnu.linkonce.r*)
-    . = ALIGN(4);
-     PROVIDE (_data_end = .) ;
-  }  > dmem
-  .resource_table   :
-  {
-    KEEP (*(.resource_table))
-  }  > dmem
-  .bss   :
-  {
-     PROVIDE (_bss_start = .) ;
-    *(.bss)
-     *(.bss.*)
-     *(.bss:*)
-    *(.gnu.linkonce.b*)
-    *(COMMON)
-     PROVIDE (_bss_end = .) ;
-  }  > dmem
-  /* Global data not cleared after reset.  */
-  .noinit   :
-  {
-     PROVIDE (_noinit_start = .) ;
-    *(.noinit)
-     PROVIDE (_noinit_end = .) ;
-     PROVIDE (_heap_start = .) ;
-     . += __HEAP_SIZE ;
-    /* Stack is not here really.  It will be put at the end of DMEM.
-       But we take into account its size here, in order to allow
-       for MEMORY overflow checking during link time.  */
-     . += __STACK_SIZE ;
-  }  > dmem
-  /* Stabs debugging sections.  */
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  .stab.excl 0 : { *(.stab.excl) }
-  .stab.exclstr 0 : { *(.stab.exclstr) }
-  .stab.index 0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment 0 : { *(.comment) }
-  .note.gnu.build-id   : { *(.note.gnu.build-id) }
-  /* DWARF debug sections.
-     Symbols in the DWARF debugging sections are relative to the beginning
-     of the section so we begin them at 0.  */
-  /* DWARF 1 */
-  .debug          0 : { *(.debug) }
-  .line           0 : { *(.line) }
-  /* GNU DWARF 1 extensions */
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  /* DWARF 1.1 and DWARF 2 */
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-  /* DWARF 2 */
-  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
-  .debug_abbrev   0 : { *(.debug_abbrev) }
-  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end) }
-  .debug_frame    0 : { *(.debug_frame) }
-  .debug_str      0 : { *(.debug_str) }
-  .debug_loc      0 : { *(.debug_loc) }
-  .debug_macinfo  0 : { *(.debug_macinfo) }
-  /* SGI/MIPS DWARF 2 extensions */
-  .debug_weaknames 0 : { *(.debug_weaknames) }
-  .debug_funcnames 0 : { *(.debug_funcnames) }
-  .debug_typenames 0 : { *(.debug_typenames) }
-  .debug_varnames  0 : { *(.debug_varnames) }
-  /* DWARF 3 */
-  .debug_pubtypes 0 : { *(.debug_pubtypes) }
-  .debug_ranges   0 : { *(.debug_ranges) }
-  /* DWARF Extension.  */
-  .debug_macro    0 : { *(.debug_macro) }
-  .debug_addr     0 : { *(.debug_addr) }
-}
-
-


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-09 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 18:16 [newlib-cygwin] libgloss: pru: Remove sim ld script Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).