From b7e24eef35ad6cfad5ebe645144d6dd28c0ce10a Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Fri, 11 Oct 1991 23:47:05 +0000 Subject: [PATCH] * news.sc: Add alignment for data segment. * ldtemplate: Add (yet another) script to get for -n or -N options. (These need different alignment than ZMAGIC files.) * Makefile.in: Add stuff for new foo.xn scripts. These are generated by replacing "ALIGN(0x...00)" by ".". --- ld/ChangeLog | 8 ++++++++ ld/Makefile.in | 28 ++++++++++++++++++++-------- ld/ldtemplate | 6 +++++- ld/news.sc | 4 ++-- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 98879120e5f..a7761a0973a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +Fri Oct 11 16:42:22 1991 Per Bothner (bothner at cygnus.com) + + * news.sc: Add alignment for data segment. + * ldtemplate: Add (yet another) script to get for -n or -N + options. (These need different alignment than ZMAGIC files.) + * Makefile.in: Add stuff for new foo.xn scripts. + These are generated by replacing "ALIGN(0x...00)" by ".". + Fri Oct 11 15:43:04 1991 Roland H. Pesch (pesch at cygnus.com) * Makefile.in: new targets ld.ms, ld-index.ms diff --git a/ld/Makefile.in b/ld/Makefile.in index d52b73c00a1..71523b1e8a8 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -52,7 +52,7 @@ SCRIPTS = ldgld68k.sc ldgld.sc \ CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES) LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) -.SUFFIXES: .y .x .xr .xu .sc .scu .scr $(SUFFIXES) +.SUFFIXES: .y .x .xr .xu .xn .sc .scu .scr .scn $(SUFFIXES) # go directly to ld.new in case this ld isn't capable of # linking native object on this host. It can be renamed on @@ -63,6 +63,8 @@ LD_PROG = ld.new # sed is used to transform this script into two variant forms: # A .scr script is for linking without relocation (-r flag). # A .scu script is like .scr, but *do* create constructors. +# A .scu script is for linking to non-demand-paged output (-N or -n). +# The diference is that segments should (need) not be page aligned. # A sed pattern to translate .sc to .scu: SED_MAKE_RELOC_WITH_CONSTRUCTORS=\ @@ -73,13 +75,19 @@ SED_MAKE_RELOC_WITH_CONSTRUCTORS=\ -e "/data/s/[.]data .*:/.data :/" # A sed pattern to translate .scu to .scr: SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d +# A sed pattern to translate .sc to .scn: +# We assume that any reasonable page size ends with 00 +# (Some things are aligned on 8-byte boundaries; ignore those.) +SED_DONT_ALIGN= -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./' .sc.scu: sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $< >$*.scu +.sc.scn: + sed $(SED_DONT_ALIGN) $< >$*.scn .scu.scr: sed $(SED_REMOVE_CONSTRUCTORS) < $< >$*.scr -# Each .sc .scr or .scu script is filtered by mkscript +# Each .sc .scr .scu or .scn script is filtered by mkscript # into a string literal that can be included in a .c program. .sc.x: if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \ @@ -92,11 +100,15 @@ SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d ./mkscript < $< >$*.xu .scr.xr: ./mkscript < $< >$*.xr +.scn.xn: + ./mkscript < $< >$*.xn .sc.xu: sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) < $< | ./mkscript >$*.xu .sc.xr: sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $(SED_REMOVE_CONSTRUCTORS) \ < $< | ./mkscript >$*.xr +.sc.xn: + sed $(SED_DONT_ALIGN) < $< | ./mkscript >$*.xn # for self hosting BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a @@ -162,12 +174,12 @@ ldm88k.c: $(srcdir)/ldtemplate -e s/""/m88kbcs/g -e s/""/M88KBCS/g <$< >$@ # The .c files for these are generated from ldtemplete. -ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu -news.o: ./mkscript news.x news.xr news.xu -ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu -ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu -ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu -ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu +ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn +news.o: ./mkscript news.x news.xr news.xu news.xn +ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu ebmon29k.xn +ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu ldgld68k.xn +ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu ldglda29k.xn +ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn # The .c files for these are (for now) specially written (not ldtemplete). ldgld960.o: ./mkscript ldgld960.x diff --git a/ld/ldtemplate b/ld/ldtemplate index dc9128317bb..54e397e5b76 100755 --- a/ld/ldtemplate +++ b/ld/ldtemplate @@ -126,6 +126,9 @@ static char *gld_script_option_Ur = static char *gld_script_option_r = #include ".xr" ; +static char *gld_script_option_n = /* Used with -n and -N flags. */ +#include ".xn" +; static char *gld_get_script() { @@ -137,7 +140,8 @@ static char *gld_get_script() if (config.relocateable_output == true) { return gld_script_option_r; } - + if (config.magic_demand_paged == false) + return gld_script_option_n; return gld_script; } struct ld_emulation_xfer_struct ld_gld_emulation = diff --git a/ld/news.sc b/ld/news.sc index 254d3b2e1df..ed57fedd4cf 100755 --- a/ld/news.sc +++ b/ld/news.sc @@ -11,9 +11,9 @@ SECTIONS { CREATE_OBJECT_SYMBOLS *(.text) - _etext = .; + _etext = ALIGN(0x1000); } - .data . : + .data ALIGN(0x1000) : { *(.data) CONSTRUCTORS; -- 2.30.2