From 9e63eecc3d2e0d00c0b0542dde66fc5497ae348d Mon Sep 17 00:00:00 2001 From: Camm Maguire Date: Thu, 11 Aug 2022 18:16:42 +0100 Subject: [PATCH] TODO: Put a short summary on the line above and replace this paragraph with a longer explanation of this change. Complete the meta-information with other relevant fields (see below for details). To make it easier, the information below has been extracted from the changelog. Adjust it or drop it. gcl (2.6.12-23) unstable; urgency=medium * Version_2_6_13pre29 Gbp-Pq: Name Version_2_6_13pre30 --- configure | 4 ++++ configure.in | 4 ++++ h/elf64_mips_reloc_special.h | 28 +++++++++++++++++++--------- o/main.c | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/configure b/configure index c92f0e3..ca9431e 100755 --- a/configure +++ b/configure @@ -4435,6 +4435,10 @@ case $use in # if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi ;; mips*) + case $canonical in + mips64*linux*) + TLIBS="$TLIBS -Wl,-z -Wl,now";; + esac # if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.6.2 ;; ia64*) diff --git a/configure.in b/configure.in index 85d4dfb..e9ce5e6 100644 --- a/configure.in +++ b/configure.in @@ -640,6 +640,10 @@ case $use in # if test "$enable_debug" != "yes" ; then TO2FLAGS="-O" ; fi ;; mips*) + case $canonical in + mips64*linux*) + TLIBS="$TLIBS -Wl,-z -Wl,now";; + esac # if test "$enable_debug" != "yes" ; then TO3FLAGS="-O0" ; fi #FIXME needed asof gcc 4.6.2 ;; ia64*) diff --git a/h/elf64_mips_reloc_special.h b/h/elf64_mips_reloc_special.h index 980cabe..8ad2078 100644 --- a/h/elf64_mips_reloc_special.h +++ b/h/elf64_mips_reloc_special.h @@ -6,18 +6,28 @@ static ul ggot,ggote; static Rela *hr; #define ELF_R_TYPE(a_) (((a_>>40)&0xff) ? ((a_>>40)&0xff) : ((a_>>56)&0xff)) #define ELF_R_FTYPE(a_) ((a_>>56)&0xff) +typedef struct { + ul entry,gotoff; + unsigned int ld_gotoff,lw,jr,lwcan; +} call_16_tramp; + static int write_stub(ul s,ul *got,ul *gote) { - int *goti; + static call_16_tramp t1={0,0, + (0x37<<26)|(0x1c<<21)|(0x19<<16), /*ld t9,(0)gp*/ + (0x37<<26)|(0x19<<21)|(0x19<<16), /*ld t9,(0)t9*/ + 0x03200008, /*jr t9*/ + 0 /*nop*/ + }; + call_16_tramp *t=(void *)gote; + + *t=t1; + *got=can_gp; - *gote=(ul)(goti=(void *)(gote+2)); - *++gote=s; - s=((void *)gote-(void *)got); - *goti++=(0x37<<26)|(0x1c<<21)|(0x19<<16)|s; - *goti++=(0x37<<26)|(0x19<<21)|(0x19<<16)|0; - *goti++=0x03200008; - *goti++=0x00200825; + t->entry=(ul)(gote+2); + t->gotoff=s; + t->ld_gotoff|=((void *)(gote+1)-(void *)got); return 0; @@ -31,7 +41,7 @@ make_got_room_for_stub(Shdr *sec1,Shdr *sece,Sym *sym,const char *st1,ul *gs) { if ((ssec>=sece || !ALLOC_SEC(ssec)) && (a=find_sym_ptable(st1+sym->st_name)) && a->address>=ggot && a->address>PAGEWIDTH; + return ((freep ? s.freeram : s.totalram)>>PAGEWIDTH)*s.mem_unit; } -- 2.30.2