[llvm-dev] llvm-objdump print file offset

163 views
Skip to first unread message

Oza, Hiral via llvm-dev

unread,
Jul 7, 2020, 1:22:49 PM7/7/20
to llvm...@lists.llvm.org

Hello,

 

$ objdump -h # displays info about all below sections….

Sections:

Idx Name          Size      VMA               LMA               File off  Algn

 

While,

$ llvm-objdump -h # only displays subset of info…

Sections:

Idx Name          Size      Address          Type

 

Using ‘--show-lma' could get VMA and LMA details.

 

Can you suggest options to print ‘File off’ and ‘Alng’ with llvm-objdump?

 

Thank you in advance.

 

James Henderson via llvm-dev

unread,
Jul 8, 2020, 4:28:10 AM7/8/20
to Oza, Hiral, llvm...@lists.llvm.org
Hi,

This looks like a bug in llvm-objdump's output (I'd expect it to match GNU's). There are no options to print the other columns. Could you file a bug against llvm-objdump at https://bugs.llvm.org/, please?

You could also use llvm-readelf to get equivalent output. For a simple object, it might look something like this:

C:\Work\TOOLCHAIN-5886> \llvm\build\Debug\bin\llvm-readelf.exe -S C:\Work\TempWork\bar.o
There are 12 section headers, starting at offset 0x208:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
  [ 1] .strtab           STRTAB          0000000000000000 000198 000070 00      0   0  1
 ...

It produces GNU readelf-style output, but this won't show you LMA output (and there is no option to do so I'm afraid).

Hope that helps,

James

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Oza, Hiral via llvm-dev

unread,
Jul 8, 2020, 12:36:05 PM7/8/20
to jh737...@my.bristol.ac.uk, llvm...@lists.llvm.org

Thanks James it seems worked for me :)

I am facing some issues in login into bugs.llvm.org, I will file once I get access. Pls feel free if you have login :)

 

Thank you again.

Jordan Rupprecht via llvm-dev

unread,
Jul 8, 2020, 12:47:02 PM7/8/20
to Oza, Hiral, llvm...@lists.llvm.org
I have an ancient patch where I fixed this, see https://reviews.llvm.org/D68669. But it was more of a proof of concept, with lots of TODOs & no tests written for it (just existing tests updated). If someone wanted to take that patch and iterate on it, that might be faster than waiting for me.

Fāng-ruì Sòng via llvm-dev

unread,
Jul 8, 2020, 7:30:14 PM7/8/20
to Jordan Rupprecht, llvm...@lists.llvm.org, George Rimar
On 2020-07-08, Jordan Rupprecht via llvm-dev wrote:
>I have an ancient patch where I fixed this, see
>https://reviews.llvm.org/D68669. But it was more of a proof of concept,
>with lots of TODOs & no tests written for it (just existing tests updated).
>If someone wanted to take that patch and iterate on it, that might be
>faster than waiting for me.

If the lack of "LMA" column causes confusion, perhaps we should revisit
the resolution to https://reviews.llvm.org/D57146 ?

(Personally I don't use objdump -h. I know many other users considering
objdump -h output less genuine and using readelf -S as a replacement.)

>On Wed, Jul 8, 2020 at 9:36 AM Oza, Hiral via llvm-dev <
>llvm...@lists.llvm.org> wrote:
>
>> Thanks James it seems worked for me :)
>>
>> I am facing some issues in login into bugs.llvm.org, I will file once I
>> get access. Pls feel free if you have login :)
>>
>>
>>
>> Thank you again.
>>
>>
>>
>>
>>

>> *From:* James Henderson <jh737...@my.bristol.ac.uk>
>> *Sent:* Wednesday, July 8, 2020 1:58 PM
>> *To:* Oza, Hiral <Hira...@netapp.com>
>> *Cc:* llvm...@lists.llvm.org
>> *Subject:* Re: [llvm-dev] llvm-objdump print file offset

Reply all
Reply to author
Forward
0 new messages