mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2025-03-02 22:36:27 +00:00
* Makefile.in, ldtemplate: Need to use separate scripts
for -n and -N options. Yet more complication.
This commit is contained in:
parent
fd671dc421
commit
972e7b4bc4
@ -1,3 +1,8 @@
|
||||
Mon Oct 14 17:27:24 1991 Per Bothner (bothner at cygnus.com)
|
||||
|
||||
* Makefile.in, ldtemplate: Need to use separate scripts
|
||||
for -n and -N options. Yet more complication.
|
||||
|
||||
Fri Oct 11 22:40:46 1991 John Gilmore (gnu at cygnus.com)
|
||||
|
||||
* Makefile.in: Avoid using $< in explicit Make rules (it doesn't
|
||||
|
@ -52,7 +52,7 @@ SCRIPTS = ldgld68k.sc ldgld.sc \
|
||||
CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES)
|
||||
LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
|
||||
|
||||
.SUFFIXES: .y .x .xr .xu .xn .sc .scu .scr .scn $(SUFFIXES)
|
||||
.SUFFIXES: .y .x .xr .xu .xn .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,7 +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).
|
||||
# A .scn script is for linking with -N flag (mix text and data on same page).
|
||||
# A .scN script is for linking with -N flag (mix text and data on same page).
|
||||
# The diference is that segments should (need) not be page aligned.
|
||||
|
||||
# A sed pattern to translate .sc to .scu:
|
||||
@ -75,40 +76,47 @@ 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 .scu or .scn script is filtered by mkscript
|
||||
# into a string literal that can be included in a .c program.
|
||||
# Each builtin script file is included as a C string literal.
|
||||
# These are generated by the mkscript filter.
|
||||
.sc.x:
|
||||
if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \
|
||||
else \
|
||||
(sed <$< -e '/SEARCH_DIR(.*)/d' ; \
|
||||
echo $(LIB_PATH) | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | ./mkscript >$*.x;\
|
||||
fi
|
||||
# ./mkscript < $< >$*.x
|
||||
.scu.xu:
|
||||
./mkscript < $< >$*.xu
|
||||
.scr.xr:
|
||||
./mkscript < $< >$*.xr
|
||||
.scn.xn:
|
||||
./mkscript < $< >$*.xn
|
||||
|
||||
# The .xn script is used if the -n flag is given (write-protect text)..
|
||||
# Sunos starts the text segment for demand-paged binaries at 0x2020
|
||||
# and other binaries at 0x2000, since the exec header is paged in
|
||||
# with the text. Some other Unix variants do the same.
|
||||
# For -n and -N flags the offset of the exec header must be removed.
|
||||
# This sed script does this if the master script contains
|
||||
# a line of the form ".text 0xAAAA BLOCK(0xBBBB):" - the
|
||||
# output will contain ".text 0xBBBB:". (For Sunos AAAA=2020 and BBBB=2000.)
|
||||
.x.xn:
|
||||
sed -e '/text/s/\.text .* BLOCK(\([^)]*\)):/.text \1:/' < $< >$*.xn
|
||||
|
||||
# The .xN script is used if the -N flag is given (don't write-protect text).
|
||||
# This is like -n, except that the data segment need not be page-aligned.
|
||||
# So get rid of commands for page-alignment: We assume these use ALIGN
|
||||
# with a hex constant that end with 00, since any normal page size is be
|
||||
# at least divisible by 256. We use the 00 to avoid matching
|
||||
# anything that tries to align of (say) 8-byte boundaries.
|
||||
.xn.xN:
|
||||
sed -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./' < $< >$*.xN
|
||||
|
||||
# The xu and xr scripts don't search libraries, so LIB_PATH doesn't matter.
|
||||
.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
|
||||
@ -174,12 +182,15 @@ ldm88k.c: $(srcdir)/ldtemplate
|
||||
-e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$(srcdir)/ldtemplate >$@
|
||||
|
||||
# The .c files for these are generated from ldtemplete.
|
||||
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
|
||||
ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn ldgld.xN
|
||||
news.o: ./mkscript news.x news.xr news.xu news.xn news.xN
|
||||
ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu \
|
||||
ebmon29k.xn ebmon29k.xN
|
||||
ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu \
|
||||
ldgld68k.xn ldgld68k.xN
|
||||
ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu \
|
||||
ldglda29k.xn ldglda29k.xN
|
||||
ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn ldm88k.xN
|
||||
|
||||
# The .c files for these are (for now) specially written (not ldtemplete).
|
||||
ldgld960.o: ./mkscript ldgld960.x
|
||||
@ -309,7 +320,7 @@ de-stage3: force
|
||||
|
||||
clean:
|
||||
- rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
|
||||
- rm -f *.x *.x[ru] *.sc[ur]
|
||||
- rm -f *.x *.x[runN] *.sc[runN]
|
||||
- rm -f ld.?? ld.???
|
||||
- rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
|
||||
|
||||
|
@ -126,9 +126,12 @@ static char *gld<target>_script_option_Ur =
|
||||
static char *gld<target>_script_option_r =
|
||||
#include "<ldtarget>.xr"
|
||||
;
|
||||
static char *gld<target>_script_option_n = /* Used with -n and -N flags. */
|
||||
static char *gld<target>_script_option_n = /* Used with -n flag. */
|
||||
#include "<ldtarget>.xn"
|
||||
;
|
||||
static char *gld<target>_script_option_N = /* Used with -N flag. */
|
||||
#include "<ldtarget>.xN"
|
||||
;
|
||||
|
||||
static char *gld<target>_get_script()
|
||||
{
|
||||
@ -140,7 +143,9 @@ static char *gld<target>_get_script()
|
||||
if (config.relocateable_output == true) {
|
||||
return gld<target>_script_option_r;
|
||||
}
|
||||
if (config.magic_demand_paged == false)
|
||||
if (!config.text_read_only)
|
||||
return gld<target>_script_option_N;
|
||||
if (!config.magic_demand_paged)
|
||||
return gld<target>_script_option_n;
|
||||
return gld<target>_script;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user