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.92 #3 (Red Hat Linux)) id 1i4gTQ-000695-I2 for barebox@lists.infradead.org; Mon, 02 Sep 2019 07:10:02 +0000 Date: Mon, 2 Sep 2019 09:09:56 +0200 (CEST) From: =?utf-8?Q?Cl=C3=A9ment?= Leger Message-ID: <1657838643.61704068.1567408196329.JavaMail.zimbra@kalray.eu> In-Reply-To: References: <20190327074851.jva5cfg2jnbvfviq@pengutronix.de> <20190901140908.17966-1-cleger@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: Re: [PATCH v3] elf: add 64 bits elf loading support To: Oleksij Rempel Cc: Barebox List SGkgT2xla3NpaiwKClRoYW5rcyBmb3IgdGVzdGluZywgc2luY2UgSSBvbmx5IHRlc3RlZCBvbiBh cm0sIGl0IGV4cGxhaW4gdGhpcyBwcm9ibGVtIDopCkkgd2lsbCB0cnkgdG8gc2VhcmNoIGZvciBh bGwgZWxmLT5lbnRyeSB1c2FnZSBhbmQgZml4IHRoYXQgYWNjb3JkaW5nIHRvIGFyY2hpdGVjdHVy ZXMuClRoYW5rcywKCkNsw6ltZW50CgotLS0tLSBPbiAyIFNlcCwgMjAxOSwgYXQgMDg6MDcsIE9s ZWtzaWogUmVtcGVsIG8ucmVtcGVsQHBlbmd1dHJvbml4LmRlIHdyb3RlOgoKPiBIaSBDbGVtZW50 LAo+IAo+IHRoYW5rIHlvdSBmb3IgeW91ciBwYXRjaC4gSSB0ZXN0ZWQgaXQgb24gTUlQUzMyIHN5 c3RlbS4KPiAKPiBJIGdldCB0aGlzIGNvbXBpbGUgd2FybmluZzoKPiBhcmNoL21pcHMvbGliL2Jv b3RtLmM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