From c55b17b8098abde4ae7dfe0ec1f3b22a7fb0a34d Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 10 Apr 2019 11:35:48 +0930 Subject: [PATCH] Fix some ld dependencies In looking at the csky-elf vs. csky-linux differences, the first thing I compared was csky_elf.sh and cskyelf_linux.sh. Those files are mostly the same but besides the real differences, annoyingly have some lines ordered differently. It's better in such cases to have one file source the other, making differences plain. This patch does that for csky and microblaze, removes an unused variable defined in a few places, and fixes ld makefile dependencies. * Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em. (ecskyelf_linux.c): Depend on cskyelf.sh. (eelf32microblazeel.c): Depend on elf32microblaze.sh. * Makefile.in: Regenerate. * emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh. (PAGE_SIZE): Don't define. * emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just the differing variable defs/undefs. * emulparams/elf32mcore.sh (PAGE_SIZE): Don't define. * emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh. (OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT. (PAGE_SIZE): Don't define. * emulparams/elf32microblazeel.sh: Source elf32microblaze.sh, leaving just the differing OUTPUT_FORMAT. --- ld/ChangeLog | 17 +++++++++++++++ ld/Makefile.am | 3 +++ ld/Makefile.in | 3 +++ ld/emulparams/cskyelf.sh | 3 ++- ld/emulparams/cskyelf_linux.sh | 35 ++++-------------------------- ld/emulparams/elf32mcore.sh | 1 - ld/emulparams/elf32microblaze.sh | 5 +++-- ld/emulparams/elf32microblazeel.sh | 25 ++------------------- 8 files changed, 34 insertions(+), 58 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index d4e3dc1aa2..4df91b7a20 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,20 @@ +2019-04-10 Alan Modra + + * Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em. + (ecskyelf_linux.c): Depend on cskyelf.sh. + (eelf32microblazeel.c): Depend on elf32microblaze.sh. + * Makefile.in: Regenerate. + * emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh. + (PAGE_SIZE): Don't define. + * emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just + the differing variable defs/undefs. + * emulparams/elf32mcore.sh (PAGE_SIZE): Don't define. + * emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh. + (OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT. + (PAGE_SIZE): Don't define. + * emulparams/elf32microblazeel.sh: Source elf32microblaze.sh, + leaving just the differing OUTPUT_FORMAT. + 2019-04-10 Alan Modra * po/BLD-POTFILES.in: Regenerate. diff --git a/ld/Makefile.am b/ld/Makefile.am index 199bacf5d7..0434a827b9 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -879,9 +879,11 @@ ecrislinux.c: $(srcdir)/emulparams/crislinux.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ecskyelf.c: $(srcdir)/emulparams/cskyelf.sh \ + $(srcdir)/emultempl/cskyelf.em \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ecskyelf_linux.c: $(srcdir)/emulparams/cskyelf_linux.sh \ + $(srcdir)/emulparams/cskyelf.sh $(srcdir)/emultempl/cskyelf.em \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ed10velf.c: $(srcdir)/emulparams/d10velf.sh \ @@ -1178,6 +1180,7 @@ eelf32metag.c: $(srcdir)/emulparams/elf32metag.sh \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \ + $(srcdir)/emulparams/elf32microblaze.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \ diff --git a/ld/Makefile.in b/ld/Makefile.in index edaf530a65..3aede6e798 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -2482,9 +2482,11 @@ ecrislinux.c: $(srcdir)/emulparams/crislinux.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ecskyelf.c: $(srcdir)/emulparams/cskyelf.sh \ + $(srcdir)/emultempl/cskyelf.em \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ecskyelf_linux.c: $(srcdir)/emulparams/cskyelf_linux.sh \ + $(srcdir)/emulparams/cskyelf.sh $(srcdir)/emultempl/cskyelf.em \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ed10velf.c: $(srcdir)/emulparams/d10velf.sh \ @@ -2781,6 +2783,7 @@ eelf32metag.c: $(srcdir)/emulparams/elf32metag.sh \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} eelf32microblazeel.c: $(srcdir)/emulparams/elf32microblazeel.sh \ + $(srcdir)/emulparams/elf32microblaze.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elfmicroblaze.sc ${GEN_DEPENDS} eelf32microblaze.c: $(srcdir)/emulparams/elf32microblaze.sh \ diff --git a/ld/emulparams/cskyelf.sh b/ld/emulparams/cskyelf.sh index 218951c730..c9f7e3fa5c 100644 --- a/ld/emulparams/cskyelf.sh +++ b/ld/emulparams/cskyelf.sh @@ -1,9 +1,10 @@ +# If you change this file, please also look at files which source this one: +# cskyelf_linux.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-csky-little" BIG_OUTPUT_FORMAT="elf32-csky-big" LITTLE_OUTPUT_FORMAT="elf32-csky-little" NO_REL_RELOCS=yes -PAGE_SIZE=0x1000 TARGET_PAGE_SIZE=0x400 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" TEXT_START_ADDR=0x8000 diff --git a/ld/emulparams/cskyelf_linux.sh b/ld/emulparams/cskyelf_linux.sh index 118be1acec..135ea1f954 100644 --- a/ld/emulparams/cskyelf_linux.sh +++ b/ld/emulparams/cskyelf_linux.sh @@ -1,36 +1,9 @@ -SCRIPT_NAME=elf -OUTPUT_FORMAT="elf32-csky-little" -BIG_OUTPUT_FORMAT="elf32-csky-big" -LITTLE_OUTPUT_FORMAT="elf32-csky-little" -NO_REL_RELOCS=yes -TARGET_PAGE_SIZE=0x400 -MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +. ${srcdir}/emulparams/cskyelf.sh + +unset EMBEDDED +unset ENTRY COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)" -CHECK_RELOCS_AFTER_OPEN_INPUT=yes -TEXT_START_ADDR=0x8000 -NONPAGED_TEXT_START_ADDR=0 -ARCH=csky GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes - -# There is a problem with the NOP value - it must work for both -# big endian and little endian systems. Unfortunately there is -# no symmetrical mcore opcode that functions as a noop. The -# chosen solution is to use "tst r0, r14". This is a symmetrical -# value, and apart from the corruption of the C bit, it has no other -# side effects. Since the carry bit is never tested without being -# explicitly set first, and since the NOP code is only used as a -# fill value between independently viable pieces of code, it should -# not matter. -NOP=0 - -OTHER_BSS_SYMBOLS="__bss_start__ = . ;" -OTHER_BSS_END_SYMBOLS="__bss_end__ = . ;" - -# This sets the stack to the top of the simulator memory (2^19 bytes). -# STACK_ADDR=0x80000 - -TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_COMBRELOC_SCRIPT=yes -EXTRA_EM_FILE=cskyelf diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh index 8a09bba2c8..ee988129c4 100644 --- a/ld/emulparams/elf32mcore.sh +++ b/ld/emulparams/elf32mcore.sh @@ -3,7 +3,6 @@ OUTPUT_FORMAT="elf32-mcore-little" BIG_OUTPUT_FORMAT="elf32-mcore-big" LITTLE_OUTPUT_FORMAT="elf32-mcore-little" NO_REL_RELOCS=yes -PAGE_SIZE=0x1000 TARGET_PAGE_SIZE=0x400 MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" TEXT_START_ADDR=0 diff --git a/ld/emulparams/elf32microblaze.sh b/ld/emulparams/elf32microblaze.sh index 8595e2dba4..116e37d070 100644 --- a/ld/emulparams/elf32microblaze.sh +++ b/ld/emulparams/elf32microblaze.sh @@ -1,7 +1,9 @@ +# If you change this file, please also look at files which source this one: +# elf32microblazeel.sh SCRIPT_NAME=elfmicroblaze -OUTPUT_FORMAT="elf32-microblaze" BIG_OUTPUT_FORMAT="elf32-microblaze" LITTLE_OUTPUT_FORMAT="elf32-microblazeel" +OUTPUT_FORMAT=$BIG_OUTPUT_FORMAT #TEXT_START_ADDR=0 NONPAGED_TEXT_START_ADDR=0x28 ALIGNMENT=4 @@ -13,7 +15,6 @@ NOP=0x80000000 # Hmmm, there's got to be a better way. This sets the stack to the # top of the simulator memory (2^19 bytes). -#PAGE_SIZE=0x1000 #DATA_ADDR=0x10000 #OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }' #$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} diff --git a/ld/emulparams/elf32microblazeel.sh b/ld/emulparams/elf32microblazeel.sh index 86268b0ac5..14f3b3bf56 100644 --- a/ld/emulparams/elf32microblazeel.sh +++ b/ld/emulparams/elf32microblazeel.sh @@ -1,23 +1,2 @@ -SCRIPT_NAME=elfmicroblaze -OUTPUT_FORMAT="elf32-microblazeel" -BIG_OUTPUT_FORMAT="elf32-microblaze" -LITTLE_OUTPUT_FORMAT="elf32-microblazeel" -#TEXT_START_ADDR=0 -NONPAGED_TEXT_START_ADDR=0x28 -ALIGNMENT=4 -MAXPAGESIZE=4 -ARCH=microblaze -EMBEDDED=yes - -NOP=0x80000000 - -# Hmmm, there's got to be a better way. This sets the stack to the -# top of the simulator memory (2^19 bytes). -#PAGE_SIZE=0x1000 -#DATA_ADDR=0x10000 -#OTHER_RELOCATING_SECTIONS='.stack 0x7000 : { _stack = .; *(.stack) }' -#$@{RELOCATING+ PROVIDE (__stack = 0x7000);@} -#OTHER_RELOCATING_SECTIONS='PROVIDE (_stack = _end + 0x1000);' - -TEMPLATE_NAME=elf32 -#GENERATE_SHLIB_SCRIPT=yes +. ${srcdir}/emulparams/elf32microblaze.sh +OUTPUT_FORMAT=$LITTLE_OUTPUT_FORMAT -- 2.34.1