Skip to content

Instantly share code, notes, and snippets.

@7shi
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7shi/297fdae231b3caa2dbd7 to your computer and use it in GitHub Desktop.
Save 7shi/297fdae231b3caa2dbd7 to your computer and use it in GitHub Desktop.
『熱血!アセンブラ入門』のサンプルをgcc-4.6に対応 http://kozos.jp/books/asm/
--- cross/sample/Makefile.orig 2015-02-17 09:32:31.971191600 +0900
+++ cross/sample/Makefile 2015-02-17 11:05:54.315289300 +0900
@@ -3,19 +3,26 @@
# other architectures.
TARGETS += arc-elf.d avr-elf.d cris-elf.d fr30-elf.d frv-elf.d hppa-linux.d
-TARGETS += m32r-elf.d m6811-elf.d m68k-elf.d mcore-elf.d mips64-elf.d
-TARGETS += mmix-elf.d mn10300-elf.d pdp11-aout.d powerpc64-linux.d s390-linux.d
-TARGETS += sh64-elf.d sparc-elf.d strongarm-elf.d v850-elf.d x86_64-linux.d
-TARGETS += xscale-elf.d xstormy16-elf.d xtensa-elf.d
+TARGETS += m32r-elf.d m68k-elf.d mcore-elf.d mips64-elf.d
+TARGETS += mmix-mmixware.d mn10300-elf.d pdp11-aout.d powerpc64-linux.d s390-linux.d
+TARGETS += sh64-elf.d sparc-elf.d v850-elf.d x86_64-elf.d
+TARGETS += xstormy16-elf.d xtensa-elf.d
+
+# obsolete in gcc-4.6
+#TARGETS += m6811-elf.d strongarm-elf.d xscale-elf.d
# need patches to build cross binutils/gcc.
-TARGETS += alpha-elf.d ia64-elf.d vax-netbsdelf.d
+TARGETS += alpha-netbsdelf.d ia64-elf.d vax-netbsdelf.d
# need obsolete option to build cross gcc.
-TARGETS += i960-elf.d
+#TARGETS += i960-elf.d
# use compiler for main architecture.
-TARGETS += arm16-elf.d avr8-elf.d h8300h-elf.d m6811s-elf.d mips16-elf.d
+TARGETS += arm16-elf.d avr8-elf.d h8300h-elf.d mips16-elf.d #m6811s-elf.d
+
+# new for gcc-4.6
+TARGETS += bfin-elf.d m32c-elf.d microblaze-elf.d moxie-elf.d
+TARGETS += rx-elf.d score-elf.d sparc64-elf.d spu-elf.d
SRCS = $(TARGETS:.d=.c)
ASMS = $(TARGETS:.d=.s)
@@ -24,7 +31,7 @@
SOURCE = sample.c
-PREFIX = /usr/local/cross
+PREFIX = /opt/cross
BINDIR = $(PREFIX)/bin
# common options.
@@ -48,6 +55,8 @@
TGCC-m6811s-elf = m6811-elf
FGCC-mips16-elf = mips16-elf
TGCC-mips16-elf = mips-elf
+FGCC-mips64-elf = mips64-elf
+TGCC-mips64-elf = mips-elf
# general options.
GFLAGS-arm16-elf += -mthumb -mthumb-interwork
@@ -61,7 +70,7 @@
#GFLAGS-pdp11-aout += -mint32
GFLAGS-powerpc64-linux += -mpowerpc64 -mcpu=powerpc64 -mtune=powerpc64
GFLAGS-sh64-elf += -m5-64media
-GFLAGS-x86_64-linux += -m64
+GFLAGS-x86_64-elf += -m64
# options without symbols defined on linker script.
#GFLAGS-avr-elf += -minit-stack=0xfe1c00
@@ -83,12 +92,14 @@
NOGFLAGS-m6811-elf += -g
NOGFLAGS-m6811s-elf += -g
NOGFLAGS-pdp11-aout += -g
+NOGFLAGS-microblaze-elf += -g
# compile options.
NOCFLAGS-i386-elf += -fverbose-asm
CFLAGS-i960-elf += -DNO_DIRECT
CFLAGS-ia64-elf += -DNO_DIRECT -DNO_BINARY
CFLAGS-mmix-elf += -DNO_DIRECT
+CFLAGS-mmix-mmixware += -DNO_DIRECT
# assemble options.
AFLAGS-arc-elf += -Wa,-marc5
@@ -98,8 +109,9 @@
LFLAGS-ia64-elf += -mgnu-ld
#LFLAGS-ia64-elf += -Wl,-r
#NOLFLAGS-ia64-elf += -Wl,-Tld.scr
-LFLAGS-x86_64-linux += -Wl,-n
+LFLAGS-x86_64-elf += -Wl,-n
LFLAGS-xstormy16-elf += -Wl,-Ttext -Wl,0x1400
+LFLAGS-spu-elf += -Wl,-Ttext -Wl,0x1400
# disassemble options.
#DFLAGS-arm-elf += -M reg-names-raw
--- cross/sample/ld.scr.orig 2015-02-17 10:46:31.163760800 +0900
+++ cross/sample/ld.scr 2015-02-17 10:50:35.166717000 +0900
@@ -36,6 +36,9 @@
/* for HP/PA without option -mfast-indirect-calls */
$$dyncall = .; . += 4;
+ /* for M32C */
+ mem0 = .; . += 4; mem2 = .; . += 4; m32c_jsri16 = .; . += 4;
+
.rodata : {
*(.rodata .rodata.*)
_erodata = .;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment