linux - Which section does objdump disassemble by default -
i building bare metal executeable, contains special sections containing code. however, when objdump -d
code .text
, .init.text
sections. manpage objdump
says "only disassembles sections expected contain instructions" when using -d
option. sections these, , how objdump
tell sections decode? know can use -d
option full decoding of sections, more need.
objdump
internally uses libbfd
section information. objdump
passes callback bfd_map_over_sections()
calls callback on each section. when called, libbfd
passes asection *
callback, has member type
. if type contains flags sec_contents | sec_code
gets disassembled objdump
when -d
option passed.
getting libbfd
quite harder, expect type detection depends on architecture, hope gave @ least right pointer. (probably when having more time i'll dig more , extend answer)..
btw, if need script filter out sections of interest objdump -d
might use sed
, this:
# ------------place section names here ---------------vvv objdump -d object.o | sed -rn '/disassembly of.*\.(comment|text)/{:a;p;n;/disassembly of/!ba}'
Comments
Post a Comment