Hi again,

Sorry for the late reply. Hopefully we can still fix this.

On Sat, Jun 08, 2019 at 10:35PM, Paul Gevers wrote:
> I *think* we could also binNMU in experimental. And we could just try a
> couple of packages that you know that won't work right now.

I tried to find a package which has as fewer Haskell dependencies as
possible and found happy, which build-depends only on ghc.

The current version of happy on ARMEL is broken:

        objdump -d /usr/bin/happy |grep  uxth
          15c0ac:       e6ff1072        uxth    r1, r2
          15c184:       e6ff2073        uxth    r2, r3
          1ab0ac:       e6ff107e        uxth    r1, lr
          1ab0e8:       e6ff1073        uxth    r1, r3
          1ab158:       e6ff107e        uxth    r1, lr
          1ab19c:       e6ff1073        uxth    r1, r3
      ...

(notice that the UXTH command is supported only on ARMv6 or later [1])

[1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0489i/CIHHJCFE.html

and I can trigger the above instruction with:

        $ gdb -q -ex 'b *(0x1ab0ac)' -ex 'run' -ex 'x/i $pc' -ex 'quit' --args 
happy example.y
        Reading symbols from happy...(no debugging symbols found)...done.
        Breakpoint 1 at 0x1ab0ac
        Starting program: /usr/bin/happy example.y
        [Thread debugging using libthread_db enabled]
        Using host libthread_db library 
"/lib/arm-linux-gnueabi/libthread_db.so.1".

        Breakpoint 1, 0x001ab0ac in ?? ()
        => 0x1ab0ac:    uxth    r1, lr
        A debugging session is active.

                        Inferior 1 [process 29559] will be killed.

        Quit anyway? (y or n) y

As input, I used the attached example taken from [2].

[2] https://www.haskell.org/happy/doc/html/sec-using.html

I then rebuild ghc with the proposed patch on abel, and used that to
rebuild happy. The final binary does not contain the UXTH instruction.

I have uploaded both ghc and happy here, in case you need Emanuele to
verify that the current version of happy fails, whereas the new one
works:

    https://www.iliastsi.net/ghc/ghc_8.4.4+dfsg1-2+armel0_armel.deb
      sha256: 5d8dae44d79545aeee34755baa6c51ffe80db8309051978aaa9ac8857d6efde9 
    https://www.iliastsi.net/ghc/ghc-doc_8.4.4+dfsg1-2+armel0_all.deb
      sha256: bffaf0957deb767d75e251f92dd8a59c6277c5b986241219fbb26ea3400284fa
    https://www.iliastsi.net/ghc/ghc-prof_8.4.4+dfsg1-2+armel0_armel.deb
      sha256: 8fde49d87ad410ae5fec77ac89af4da11f4a2dd0924f0085a2f5f9c6e93fc09c
    https://www.iliastsi.net/ghc/happy_1.19.9-6+armel0_armel.deb
      sha256: c560c02e7369c08de18f7151bcb53245a1c7f4ab83e9c07265beef7ca0e24921

So, it seems that the proposed patch does indeed resolve the issue.
Unfortunately, I cannot provide any guarantee that it will not introduce
any bugs that weren't there before, but I believe the only way to find
out is to upload a fixed version of GHC on unstable and schedule the
required binNMUs. If all of them succeed, we can then unblock them.

-- 
Ilias
{
module Main where
}

%name calc
%tokentype { Token }
%error { parseError }

%token 
      let             { TokenLet }
      in              { TokenIn }
      int             { TokenInt $$ }
      var             { TokenVar $$ }
      '='             { TokenEq }
      '+'             { TokenPlus }
      '-'             { TokenMinus }
      '*'             { TokenTimes }
      '/'             { TokenDiv }
      '('             { TokenOB }
      ')'             { TokenCB }

%%

Exp   : let var '=' Exp in Exp  { Let $2 $4 $6 }
      | Exp1                    { Exp1 $1 }

Exp1  : Exp1 '+' Term           { Plus $1 $3 }
      | Exp1 '-' Term           { Minus $1 $3 }
      | Term                    { Term $1 }

Term  : Term '*' Factor         { Times $1 $3 }
      | Term '/' Factor         { Div $1 $3 }
      | Factor                  { Factor $1 }

Factor                    
      : int                     { Int $1 }
      | var                     { Var $1 }
      | '(' Exp ')'             { Brack $2 }

{

parseError :: [Token] -> a
parseError _ = error "Parse error"

data Exp  
      = Let String Exp Exp
      | Exp1 Exp1
      deriving Show

data Exp1 
      = Plus Exp1 Term 
      | Minus Exp1 Term 
      | Term Term
      deriving Show

data Term 
      = Times Term Factor 
      | Div Term Factor 
      | Factor Factor
      deriving Show

data Factor 
      = Int Int 
      | Var String 
      | Brack Exp
      deriving Show

data Token
      = TokenLet
      | TokenIn
      | TokenInt Int
      | TokenVar String
      | TokenEq
      | TokenPlus
      | TokenMinus
      | TokenTimes
      | TokenDiv
      | TokenOB
      | TokenCB
 deriving Show


lexer :: String -> [Token]
lexer [] = []
lexer (c:cs) 
      | isSpace c = lexer cs
      | isAlpha c = lexVar (c:cs)
      | isDigit c = lexNum (c:cs)
lexer ('=':cs) = TokenEq : lexer cs
lexer ('+':cs) = TokenPlus : lexer cs
lexer ('-':cs) = TokenMinus : lexer cs
lexer ('*':cs) = TokenTimes : lexer cs
lexer ('/':cs) = TokenDiv : lexer cs
lexer ('(':cs) = TokenOB : lexer cs
lexer (')':cs) = TokenCB : lexer cs

lexNum cs = TokenInt (read num) : lexer rest
      where (num,rest) = span isDigit cs

lexVar cs =
   case span isAlpha cs of
      ("let",rest) -> TokenLet : lexer rest
      ("in",rest)  -> TokenIn : lexer rest
      (var,rest)   -> TokenVar var : lexer rest


main = getContents >>= print . calc . lexer
}

Reply via email to