SDCC: update and fixes

- Put binaries in the normal $binDir since there is no gcc2 version.
- Include Kevin Thacker's patch to generate relocatable executables for Contiki.
This commit is contained in:
Adrien Destugues
2016-01-24 11:25:44 +01:00
parent 1fd522e6f1
commit 76a1232d84
2 changed files with 433 additions and 34 deletions

View File

@@ -0,0 +1,399 @@
From 1bd79b2e8b02c9147ee3fcbeae69ece7e7070687 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 14 Sep 2014 12:25:39 +0200
Subject: let sdbinutils know about Haiku.
diff --git a/support/sdbinutils/bfd/config.bfd b/support/sdbinutils/bfd/config.bfd
index ee1d39d..386faab 100644
--- a/support/sdbinutils/bfd/config.bfd
+++ b/support/sdbinutils/bfd/config.bfd
@@ -693,6 +693,9 @@ case "${targ}" in
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386pe_vec i386pei_vec"
;;
+ i[3-7]86-*-haiku*)
+ targ_defvec=bfd_elf32_i386_vec
+ ;;
i[3-7]86-*-interix*)
targ_defvec=i386pei_vec
targ_selvecs="i386pe_vec"
--
2.7.0
From 1109aa92552ca00f54c3e9a980562f3a789104bc Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 14 Sep 2014 12:26:14 +0200
Subject: Missing include.
diff --git a/sim/ucsim/cmd.src/newcmdposixcl.h b/sim/ucsim/cmd.src/newcmdposixcl.h
index 5050d2f..ef3ed70 100644
--- a/sim/ucsim/cmd.src/newcmdposixcl.h
+++ b/sim/ucsim/cmd.src/newcmdposixcl.h
@@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "newcmdcl.h"
#include "cmdutil.h"
+#include <sys/select.h>
/*
* Command fd console
--
2.7.0
From c7067504f4e06e5905f253ac6597f611794ab8e9 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 14 Sep 2014 12:59:31 +0200
Subject: strings.h fix.
diff --git a/sim/ucsim/pobj.cc b/sim/ucsim/pobj.cc
index e809980..166d8b1 100644
--- a/sim/ucsim/pobj.cc
+++ b/sim/ucsim/pobj.cc
@@ -29,6 +29,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include <stdio.h>
#include <stdlib.h>
+#include <strings.h>
#include "pstr.h"
/*#include "pobjt.h"*/
--
2.7.0
From 93c2311eb84b19e333946332959d4fbf6bc7a975 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 14 Sep 2014 12:59:16 +0200
Subject: Remove hardcoded -lm
diff --git a/sdas/as6808/Makefile.in b/sdas/as6808/Makefile.in
index 9ed2faf..407699d 100644
--- a/sdas/as6808/Makefile.in
+++ b/sdas/as6808/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/as8051/Makefile.in b/sdas/as8051/Makefile.in
index 121110b..5df8be3 100644
--- a/sdas/as8051/Makefile.in
+++ b/sdas/as8051/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/as8xcxxx/Makefile.in b/sdas/as8xcxxx/Makefile.in
index 5dbfade..2070d1f 100644
--- a/sdas/as8xcxxx/Makefile.in
+++ b/sdas/as8xcxxx/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/asgb/Makefile.in b/sdas/asgb/Makefile.in
index e6da6ac..fe65407 100644
--- a/sdas/asgb/Makefile.in
+++ b/sdas/asgb/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/asrab/Makefile.in b/sdas/asrab/Makefile.in
index 2924ab4..fa52fe2 100644
--- a/sdas/asrab/Makefile.in
+++ b/sdas/asrab/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/asstm8/Makefile.in b/sdas/asstm8/Makefile.in
index 812b484..4a056f7 100755
--- a/sdas/asstm8/Makefile.in
+++ b/sdas/asstm8/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/astlcs90/Makefile.in b/sdas/astlcs90/Makefile.in
index c3e6a21..e50587b 100644
--- a/sdas/astlcs90/Makefile.in
+++ b/sdas/astlcs90/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/sdas/asz80/Makefile.in b/sdas/asz80/Makefile.in
index d8cc0e1..6aa7532 100644
--- a/sdas/asz80/Makefile.in
+++ b/sdas/asz80/Makefile.in
@@ -37,7 +37,7 @@ VPATH = @srcdir@
CPPFLAGS = @CPPFLAGS@ -DSDCDB -DNOICE -DINDEXLIB -I. -I$(srcdir) -I$(srcdir)/../asxxsrc -I$(srcdir)/../../support/util
CFLAGS = @CFLAGS@ @WALL_FLAG@ $(CPPFLAGS)
LDFLAGS = @LDFLAGS@
-LIBS = -lm
+LIBS =
OBJDIR = obj
diff --git a/src/Makefile.in b/src/Makefile.in
index fc22c22..ebf63f1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -15,7 +15,7 @@ PORTS = $(shell cat ../ports.build)
ALLPORTS = $(shell cat ../ports.all)
PORT_LIBS = $(PORTS:%=%/port.a)
-LIBS = -lm @LIBS@
+LIBS = @LIBS@
CFLAGS = @CFLAGS@ @WALL_FLAG@
CXXFLAGS = @CXXFLAGS@ @WALL_FLAG@
--
2.7.0
From aef811431a7cf3d20e26da1302c5fbfc6d6dd1a0 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 22 Jan 2016 21:01:19 +0100
Subject: Import Kevin Thacker patch for runtime relocation support.
diff --git a/sdas/linksrc/Makefile.in b/sdas/linksrc/Makefile.in
index 56537a5..35f1922 100644
--- a/sdas/linksrc/Makefile.in
+++ b/sdas/linksrc/Makefile.in
@@ -47,7 +47,7 @@ ASXXLIBSRC = strcmpi.c
SRC = lk_readnl.c lkaomf51.c lkar.c lkarea.c lkdata.c lkelf.c lkeval.c \
lkhead.c lklex.c lklib.c lklibr.c lklist.c lkmain.c lkmem.c \
lknoice.c lkout.c lkrel.c lkrloc.c lkrloc3.c lks19.c lksdcclib.c \
- lksym.c sdld.c lksdcdb.c lkbank.c
+ lksym.c sdld.c lksdcdb.c lkbank.c lkrrel.c
LKSOURCES = $(SRC) $(ASXXLIBSRC:%.c=$(ASXXLIB)/%.c)
diff --git a/sdas/linksrc/aslink.h b/sdas/linksrc/aslink.h
index e0865f8..d9f6316 100644
--- a/sdas/linksrc/aslink.h
+++ b/sdas/linksrc/aslink.h
@@ -1033,6 +1033,8 @@ extern int yflag; /* -y, enable SDCC Debug output
*/
#endif
+extern int hflag; /* Generate relocatable executable
+ */
extern int pflag; /* print linker command file flag
*/
extern int uflag; /* Listing relocation flag
diff --git a/sdas/linksrc/lkdata.c b/sdas/linksrc/lkdata.c
index bb83900..bfaa197 100644
--- a/sdas/linksrc/lkdata.c
+++ b/sdas/linksrc/lkdata.c
@@ -66,6 +66,9 @@ int oflag; /* Output file type flag
int objflg; /* Linked file/library object output flag
*/
+int hflag; /* Generate relocatable executable
+ */
+
#if NOICE
int jflag; /* NoICE output flag
*/
diff --git a/sdas/linksrc/lkmain.c b/sdas/linksrc/lkmain.c
index f68e8f9..bd426dd 100644
--- a/sdas/linksrc/lkmain.c
+++ b/sdas/linksrc/lkmain.c
@@ -233,6 +233,7 @@ main(int argc, char *argv[])
startp->f_idp = "";
pflag = 1;
+ hflag = 0;
for(i=1; i<argc; i++) {
ip = ib;
@@ -960,6 +961,11 @@ parse()
}
return(0);
+ case 'h':
+ case 'H':
+ hflag = 1;
+ break;
+
case 'I':
if (is_sdld() && !(TARGET_IS_Z80 || TARGET_IS_GB)) {
iramsav();
diff --git a/sdas/linksrc/lkrloc3.c b/sdas/linksrc/lkrloc3.c
index cf184f2..6f11cdc 100644
--- a/sdas/linksrc/lkrloc3.c
+++ b/sdas/linksrc/lkrloc3.c
@@ -31,6 +31,7 @@
*/
#include "aslink.h"
+#include "lkrrel.h"
/*)Module lkrloc3.c
*
@@ -332,6 +333,9 @@ relr3(void)
* Do remaining relocations
*/
while (more()) {
+ int output_relocation_record;
+ int raddr;
+
error = 0;
mode = (int) eval();
@@ -390,6 +394,95 @@ relr3(void)
reli -= paga + pags;
}
+ /* KevT 28-05-2005 */
+
+ if (hflag)
+ {
+ output_relocation_record = 0;
+ if (mode & R3_SYM)
+ {
+ /* If the symbol is defined in a absolute area, then we do not
+ output a record. This allows us to reference absolute addresses
+ in our code, but it can still be relocated */
+
+ /* If the symbol is relative, it is within our relocatable program */
+
+ /* printf("Symbol: %s\n",s[rindex]->s_id); */
+ if ((s[rindex]->s_axp->a_bap->a_flag & A4_ABS)==0)
+ {
+ output_relocation_record=1;
+ }
+ }
+ else
+ {
+ /* If the area is absolute then we do not output a record.
+ This allows us to reference absolute memory, but still the code
+ can be relocated. */
+ /* If the area is relative, it refers to data that is part of the
+ relocatable program */
+
+ /* printf("Area: %s\n",a[rindex]->a_bap->a_id); */
+ if ((a[rindex]->a_bap->a_flag & A4_ABS)==0)
+ {
+ output_relocation_record=1;
+ }
+ }
+
+ if (output_relocation_record)
+ {
+ a_uint relocate_address = pc+(rtp-rtofst);
+ if (hilo)
+ {
+ raddr = reli + ((rtval[rtp]&0x0ff)<<8) + (rtval[rtp+1]&0x0ff);
+ }
+ else
+ {
+ raddr = reli + ((rtval[rtp+1]&0x0ff)<<8) + (rtval[rtp]&0x0ff);
+ }
+ /*printf("Relocation modify address: %04x\n",relocate_address); */
+ /*printf("Relocation address: %04x\n",raddr); */
+ if (mode & R3_BYTE)
+ {
+ if (mode & R3_BYTX)
+ {
+ if (mode & R3_MSB)
+ {
+
+relrec8hi(relocate_address,raddr);
+ }
+ else
+ {
+
+relrec8lo(relocate_address,raddr);
+ }
+ }
+ else
+ {
+ printf("not supported");
+ }
+ }
+ else
+ {
+ if (mode & R3_BYTX)
+ {
+ if (mode & R3_MSB)
+ {
+ printf("not supported");
+ }
+ else
+ {
+ printf("not supported");
+ }
+ }
+ else
+ {
+ relrec16(relocate_address);
+ }
+ }
+ }
+ }
+
+
/*
* R3_BYTE or R3_WORD operation
*/
@@ -755,6 +848,12 @@ rele3()
if (uflag != 0) {
lkulist(0);
}
+
+ /* output relocation data */
+ if (hflag) {
+ relrecwrite();
+ }
+
if (oflag != 0) {
lkflush();
lkfclose();
--
2.7.0

View File

@@ -22,38 +22,38 @@ SECONDARY_ARCHITECTURES="x86"
PROVIDES="
sdcc$secondaryArchSuffix = $portVersion
cmd:sdcc$secondaryArchSuffix = $portVersion
cmd:as2gbmap$secondaryArchSuffix
cmd:makebin$secondaryArchSuffix
cmd:packihx$secondaryArchSuffix
cmd:s51$secondaryArchSuffix
cmd:savr$secondaryArchSuffix
cmd:sdar$secondaryArchSuffix
cmd:sdas390$secondaryArchSuffix
cmd:sdas6808$secondaryArchSuffix
cmd:sdas8051$secondaryArchSuffix
cmd:sdasgb$secondaryArchSuffix
cmd:sdasrab$secondaryArchSuffix
cmd:sdasstm8$secondaryArchSuffix
cmd:sdastlcs90$secondaryArchSuffix
cmd:sdasz80$secondaryArchSuffix
cmd:sdcclib$secondaryArchSuffix
cmd:sdcdb$secondaryArchSuffix
cmd:sdcdb.el$secondaryArchSuffix
cmd:sdcdbsrc.el$secondaryArchSuffix
cmd:sdcpp$secondaryArchSuffix
cmd:sdld$secondaryArchSuffix
cmd:sdld6808$secondaryArchSuffix
cmd:sdldgb$secondaryArchSuffix
cmd:sdldstm8$secondaryArchSuffix
cmd:sdldz80$secondaryArchSuffix
cmd:sdnm$secondaryArchSuffix
cmd:sdobjcopy$secondaryArchSuffix
cmd:sdranlib$secondaryArchSuffix
cmd:shc08$secondaryArchSuffix
cmd:sst7$secondaryArchSuffix
cmd:sstm8$secondaryArchSuffix
cmd:sz80$secondaryArchSuffix
cmd:sdcc = $portVersion
cmd:as2gbmap
cmd:makebin
cmd:packihx
cmd:s51
cmd:savr
cmd:sdar
cmd:sdas390
cmd:sdas6808
cmd:sdas8051
cmd:sdasgb
cmd:sdasrab
cmd:sdasstm8
cmd:sdastlcs90
cmd:sdasz80
cmd:sdcclib
cmd:sdcdb
cmd:sdcdb.el
cmd:sdcdbsrc.el
cmd:sdcpp
cmd:sdld
cmd:sdld6808
cmd:sdldgb
cmd:sdldstm8
cmd:sdldz80
cmd:sdnm
cmd:sdobjcopy
cmd:sdranlib
cmd:shc08
cmd:sst7
cmd:sstm8
cmd:sz80
"
REQUIRES="
haiku$secondaryArchSuffix
@@ -73,13 +73,13 @@ BUILD_PREREQUIRES="
cmd:make
"
PATCHES="sdcc-3.4.0.patchset"
PATCHES="sdcc-3.5.0.patchset"
BUILD()
{
# The PIC14/16 ports need gputils. Enable them when we have a recipe for it.
CFLAGS="-DO_ASYNC=0" \
runConfigure ./configure --disable-pic14-port --disable-pic16-port
runConfigure ./configure --disable-pic14-port --disable-pic16-port --bindir=$prefix/bin
make $jobArgs
}