Arm-linux-gcc/ld/objcopy/objdump parameter Summary "Go"

Source: Internet
Author: User
Tags ultraedit

Arm-linux-gcc/ld/objcopy/objdump parameter summary turn from: HTTP://BLOG.CSDN.NET/MUYUYUZHONG/ARTICLE/DETAILS/7755291ARM-LINUX-GCC- WALL-O2-C-o [email protected] $<

-O only activates preprocessing, compilation, and assembly, that is, he only makes the program obj file
-wall Specifies that all warning messages are generated
The-O2 compiler provides compiler-optimized options for the program, which can be used at compile time to improve the execution efficiency of the resulting execution file.
-C means that only the compiler is asked to compile, not link, to generate the file name of the source file, but the suffix from. C or. cc into the. O Target file
-S only activates preprocessing and compilation, which means compiling the files into assembly code

Arm-linux-ld
Directly specify the code snippet, data segment, and start address of the BSS segment
-ttest startaddr
-tdata startaddr
-TBSS STARTADDR Example:
Arm-linux-ld–ttext 0x0000000–g Led.o–o led_elf
To set an address using a connection script:
Arm-linux-ld–ttimer.lds–o timer_elf $^
Where Timer.lds is the full connection script format for the connection script:
sections{
...
Secname start Aling (aling) (NOLOAD): at (LDADDR)
{contents} > Region:phdr=fill
.....
}arm-linux-objcopy is used to copy the contents of one destination file into another file, which can be used for format conversion between different source files
Example:
Arm-linux-objcopy–o binary–s elf_file bin_file Common options:
Input-file, Outflie
Input and output files, if not outfile, the output file name is input filename 2.-l bfdname or-input-target=bfdname
Used to indicate the format of the source file, Bfdname is the standard format name that is described in the BFD library, and if not specified, the format bfdname 4.-f 3.-o bfdname output is arm-linux-objcopy, and the format of the source file is specified 5.-r SectionName Remove all segments named SectionName from the output file 6.-s do not copy the relocation information and symbol information from the source file to the destination file 7.-g do not copy the debug symbols from the source file to the destination file Arm-linux-objdump
View the target file (. o file) and library file (. a file) information
arm-linux-objdump-d-M arm led_elf > Led.dis
-D displays all assembly information in the file
-M machine
Specifies the schema used when disassembling the target file, which is useful when the disassembly file itself does not describe the schema information (such as S-records). You can use the-I option to list the schemas that can be specified here.

Common options:

1.-b Bfdname specifying the destination code format
2.-disassemble or-D disassembly executable segment
3.-dissassemble-all or-D disassembly of all segments
4.-eb,-el Specifying the byte order
5.-file-headers or-F displays the overall header summary information for the file
6.-section-headers,--headers or-H displays header summary information for each segment in the destination file
7.-info or-I display supported target file formats and CPU architectures
8.-section=name or-j name displays information for the specified section
9.-architecture=machine or-M machine specifies the schema to use when disassembling the target file

1. Modify the top-level Makefile of the source code
CC =$ (crosscom_pile) gcc---
CC =$ (crosscom_pile) gcc-g
Make genetic's vmlinux contain debug information
2. Add one more rule to all generated. O
CC-E-dd-c $< >/preprocessing/$ (shell pwd)/$<
Generate preprocessing files from inside this file can easily find the macro definition of C source file
3. objdump-h vmlinux > Vmlinux.txt
Displays the Linux kernel segment information, such as the start virtual address of the segment, the length of the segment
4. Objdump-s-l-z vmlinux > Vmlinux.txt
Disassembly Vmlinux to Vmlinux.txt,vmlinux.txt contains mixed code for assembly and C source files, which looks very handy. And I can see how Linux is running step by step.
5. Objdump-s-l-z-j xxxx (section name) vmlinux > Vmlinux.txt
Disassemble the Linux kernel segment xxxx to file Vmlinux.txt.
6. objdump-x vmlinux > X.txt
Header information for all segments in the Vmliux, including the entry address of the vmlinux of the envelope, etc.
7. Objdump--debugging vmlinux > Debugging.txt
A lot of useful debug information, such as function name, struct definition, etc.
I feel the use of the above information, UltraEdit to see very convenient. Especially in Vmlinux.txt, select the file name,
With UltraEdit right button open can be opened immediately file, very convenient.


Objdump-j. text-s vmlinux > Vmlinux.txt
-S to disassemble the source code as much as possible, especially when the compiler specifies the debug parameter-G, the effect is more obvious. The-d parameter is implied.

-l label the corresponding target code with the file name and line number, only with the-D,-D or-R use-ld and the difference between using-D is not very large, in the source-level debugging, it is useful to compile with the use of the debug compile options such as-G.

[-l |--line-numbers]
[-S |--source] Mixed assembly
[-Z |--disassemble-zeroes]
[-j section |--section=section]
[--prefix-addresses]

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Arm-linux-gcc/ld/objcopy/objdump parameter Summary "Go"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.