From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from zimbra2.kalray.eu ([92.103.151.219]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h5xkl-0003na-A9 for barebox@lists.infradead.org; Mon, 18 Mar 2019 19:16:57 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id AE20127E037F for ; Mon, 18 Mar 2019 20:16:48 +0100 (CET) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Aj4wCVBPt8sY for ; Mon, 18 Mar 2019 20:16:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 2FB7627E03B6 for ; Mon, 18 Mar 2019 20:16:48 +0100 (CET) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id sllJxb-IO66j for ; Mon, 18 Mar 2019 20:16:48 +0100 (CET) Received: from zimbra2.kalray.eu (zimbra2.kalray.eu [192.168.40.202]) by zimbra2.kalray.eu (Postfix) with ESMTP id 1644327E037F for ; Mon, 18 Mar 2019 20:16:48 +0100 (CET) Date: Mon, 18 Mar 2019 20:16:47 +0100 (CET) From: =?utf-8?Q?Cl=C3=A9ment?= Leger Message-ID: <2115635878.3947318.1552936607997.JavaMail.zimbra@kalray.eu> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] elf: add 64 bits elf support To: Barebox List VGhpcyBwYXRjaCBhZGQgZWxmNjQgbG9hZGluZyBzdXBwb3J0IHRvIHRoZSBlbGYgbG9hZGVyLiBT aW5jZQplbGYzMiBhbmQgZW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