From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14252 invoked by alias); 20 Mar 2014 18:12:06 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 14195 invoked by uid 89); 20 Mar 2014 18:12:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: tx2outboundpool.messaging.microsoft.com Received: from tx2ehsobe004.messaging.microsoft.com (HELO tx2outboundpool.messaging.microsoft.com) (65.55.88.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 20 Mar 2014 18:12:04 +0000 Received: from mail22-tx2-R.bigfish.com (10.9.14.252) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 14.1.225.22; Thu, 20 Mar 2014 18:12:02 +0000 Received: from mail22-tx2 (localhost [127.0.0.1]) by mail22-tx2-R.bigfish.com (Postfix) with ESMTP id 680E0160225; Thu, 20 Mar 2014 18:12:02 +0000 (UTC) X-Forefront-Antispam-Report: CIP:66.238.211.235;KIP:(null);UIP:(null);IPV:NLI;H:hq-edge-01.wardrobe.irobot.com;RD:66.238.211.235.ptr.us.xo.net;EFVD:NLI X-SpamScore: -1 X-BigFish: VPS-1(zz103dK1432I853kzz1f42h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah21bch1fc6hzz1de097hz2dh109h2a8h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1b0ah2222h224fh1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1fe8h1ff5h2216h22d0h2336h2438h2461h2487h24ach24d7h2516h2545h255eh25f6h2605h262fh1155h) Received: from mail22-tx2 (localhost.localdomain [127.0.0.1]) by mail22-tx2 (MessageSwitch) id 1395339120637325_29245; Thu, 20 Mar 2014 18:12:00 +0000 (UTC) Received: from TX2EHSMHS031.bigfish.com (unknown [10.9.14.242]) by mail22-tx2.bigfish.com (Postfix) with ESMTP id 5FA6F400C0; Thu, 20 Mar 2014 18:11:40 +0000 (UTC) Received: from hq-edge-01.wardrobe.irobot.com (66.238.211.235) by TX2EHSMHS031.bigfish.com (10.9.99.131) with Microsoft SMTP Server (TLS) id 14.16.227.3; Thu, 20 Mar 2014 18:11:31 +0000 Received: from hq-cas-02.wardrobe.irobot.com (192.168.172.182) by hq-edge-01.wardrobe.irobot.com (10.70.6.41) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 20 Mar 2014 14:11:29 -0400 Received: from hq-mbx-02.wardrobe.irobot.com ([fe80::1cd:dd22:52a4:4eb3]) by hq-cas-02.wardrobe.irobot.com ([192.168.172.182]) with mapi id 14.02.0347.000; Thu, 20 Mar 2014 14:11:29 -0400 From: "Radouch, Zdenek" To: "Radouch, Zdenek" , Alan Modra , "dvalin@internode.on.net" CC: "Paul_Koning@Dell.com" , "binutils@sourceware.org" Subject: RE: extract ELF load address with binutils? Date: Thu, 20 Mar 2014 18:12:00 -0000 Message-ID: <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC329D@hq-mbx-02.wardrobe.irobot.com> References: <7ADBB2DB4DC7CF4CB641E9ADA826E5E2AAC571BC@HQ-MBX-01.wardrobe.irobot.com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FBDF7F@hq-mbx-02.wardrobe.irobot.com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC0FF6@hq-mbx-02.wardrobe.irobot.com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC2052@hq-mbx-02.wardrobe.irobot.com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC207A@hq-mbx-02.wardrobe.irobot.com>,<20140318234418.GC9145@bubble.grove.modra.org> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC30E1@hq-mbx-02.wardrobe.irobot.com> In-Reply-To: <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC30E1@hq-mbx-02.wardrobe.irobot.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: irobot.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00236.txt.bz2 > Erik writes: > > Since you can run a script at the programming site, is there any reason > not to just send the elf file, so the script can extract address(es), That *is* the idea, i.e., sending a single file. > (E.g. from "objdump -h xxx.elf" and a line or two of awk, Well if you re-read my original post, I said that I simply do not know how to do it. I am an end user; I don't speak binultils internals. That is, I don't know how much variation I may face in the sections.=20 I have no idea why "objdump -h" gives me .text as the first section, and "readelf -S" on the same file gives it to me as the second one. I do not know if .text will always be the first chunk in the segment. That's why my preferred solution would be to rely on one of the binutils to figure it out for me. My second solution is to extract the info from a binutil output, as you suggested. For that, I need an algorithm for finding the section that will be placed at the beginning of the first segment.=20 I was willing to throw ten or twenty lines of python at it, if you can do it with awk, then could I please have the one English sentence that describes what needs to be done to get the load address?=20 > or nm xxx.elf | grep ), Can't use nm as there may not be a symbol for the load address > For myself, I've always just sent intel or motorola hex files for > loading to the platform - then the load address is also included, > though not so easily human-readable. (But the programming tools handle > it without human intervention, since that's what these formats are for.) > Erik You just gave me a great idea for an alternate solution (i.e., if there is no straight way to parse the section headers): objcopy -O binary foo.elf foo.data objcopy -O srec foo.elf | s19toladdr >foo.addr All I have to do in s19toladdr is to parse the first line to extract the load address. Thanks! -Z