Arm-Linux-gcc/LD/objcopy/objdump usage summary [zz]

Source: Internet
Author: User
Tags printable characters

Address: http://hi.baidu.com/xiaoyue1800/item/a11a2c4a26da4b04c11613d9

 

 

The functions of the arm-Linux tool are as follows:

Arm-linux-addr2line handleProgramThe address is converted to the file name and row number. In the command line, give it an address and an executable file name, and it will use the debugging information of this executable file to indicate which file is on the given address and the row number.

 

Arm-Linux-ar creates, modifies, and extracts archive files. An archive file is a large file that contains multiple files. Its structure ensures that the original file content can be restored.

The arm-Linux-C ++ flit connector uses it to filter the C ++ and Java symbols to prevent overload function conflicts.

Arm-Linux-GPROF displays various data of the program call segment.

Arm-Linux-LD is a connector that combines some objects with archive files, relocates data, and connects symbol references. Generally, the last step to create a new Compilation Program is to call lD.

Arm-Linux-nm lists the symbols in the target file.

Arm-Linux-objcopy copies the content of a target file to another type of target file.

Arm-Linux-objcopy-I? View supported formats

Arm-Linux-objdump displays information about one or more objects. The options are used to control the information displayed by the compiler. The information displayed by the compiler is usually only interested in the compilation tool.

Arm-Linux-ranlib generates an archive file index and saves it to this archive file. The index lists the allocable target files defined by the archive file members.

Arm-Linux-readelf displays information about executable files in ELF format.

Arm-Linux-size lists the size of each segment of the target file and the total size. By default, only one output line is generated for each module in each target file or archive file.

Arm-Linux-string prints printable strings of a file. These strings are at least 4 characters long. You can also use option-N to set the minimum length of the string. By default, it only prints printable characters in the initialization and loading segments of the target file. For other types of files, it prints printable characters of the entire file. This program is very helpful for understanding the content of non-text files.

Arm-Linux-strip discards all or specific symbols in the target file.


Arm-Linux-gcc-Wall-O2-c-o $ <

-O only activates preprocessing, compilation, and assembly, that is, he only makes the program into an OBJ file.

-Wall indicates that all warning messages are generated.

-The compilation optimization option provided by the O2 compiler for the program. This option can be used during compilation to improve the execution efficiency of the generated execution file.

-C indicates that only the compiler is required to compile the file, instead of linking it to generate a target file named after the file name of the source file but whose suffix is changed from. C or. CC to. O.

-S only activates preprocessing and compilation, which means to compile a file into an assembly.Code

 

Arm-Linux-LDSpecify the starting address of the code segment, data segment, and BSS segment.

-Tbss address set address of. BSS section

-Tdata address set address of. Data Section

-Ttext address set address of. Text Section

Example:

$ {Cross} LD-ttext = 0x33000000 led. O-o led. Elf

 

Use the connection script to set the address:

Arm-Linux-LD-tbeep. LDS start. O beep. O-o beep. Elf

Beep. LDS is the connection script as follows:

 

Arm-Linux-objcopyUsed to copy the content of a target file to another file. It 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 no OUTFILE exists, the output file name is the input file name.

2.-l bfdname or-input-target = bfdname

It is used to specify the source file format. bfdname is the standard format name described in the BFD library. If it is not specified, arm-Linux-objcopy will analyze it by itself.

3.-O bfdname output format

4.-F bfdname simultaneously specifies the format of the source file and target file

5.-R sectionname: Remove all segments named sectionname from the output file.

6.-S does not copy the relocation information and symbol information from the source file to the target file.

7.-G does not copy the debugging symbol from the source file to the target file.

 

Arm-Linux-objdump

View the information of the target file (. o file) and library file (. A file)

Arm-Linux-objdump-D-M arm beep. Elf> beep. Dis

-D: Display All assembly information in the file.

-M Machine

Specify the architecture used for the disassembly target file. This option is useful when the file to be disassembly does not describe the architecture information (such as S-records. You can use the-I option to list the architectures that can be specified here.

 

[Guowenxue @ localhost asm_c_buzzer] $ cat beep. LDS

 

/*************************************** ********************************

* File: beep. LDS

* Version: 1.0.0

* Copyright: 2011 (c) Guo wenxue <guowenxue@gmail.com>

* Description: Cross tool link text, referto u-boot.lds

* Changelog: 1, release initial version on "Mon Mar 21 21:09:52 CST 2011"

*

**************************************** *******************************/

 

Output_format ("elf32-littlearm", "elf32-littlearm", "elf32-littlearm ")

Output_arch (ARM)

Entry (_ start)

 

Sections {

. = 0x33000000;

. Text :{

* (. Text)

* (. Rodata)

}

 

. Data align (4 ):{

* (. Data)

}

 

. BSS align (4 ):{

* (. BSS)

}

}

[Guowenxue @ localhost asm_c_buzzer] $ cat makefile

#*************************************** ********************************

# * File: makefile

# * Version: 1.0.0

# * Copyright: 2011 (c) Guo wenxue <guowenxue@gmail.com>

# * Description: makefile used to cross compile the ASM and C source code

# * Changelog: 1, release initial version on "Mon Mar 21 21:09:52 CST 2011"

#*

#*************************************** ********************************

 

Cross =/opt/buildroot-2011.02/ARM920T/usr/bin/ARM-Linux-

Cflags =

 

Beep. Bin: Start. s beep. c

Arm-Linux-GCC $ (cflags)-c-o start. o start. s

Arm-Linux-GCC $ (cflags)-c-o beep. O beep. c

Arm-Linux-LD-tbeep. LDS start. O beep. O-o beep. Elf

Arm-Linux-objcopy-O Binary-s beep. Elf beep. Bin

Rm-f *. elf *. o

 

Install:

CP beep. Bin ~ /WINXP-f -- reply = Yes

 

Clean:

Rm-f *. elf *. o

Rm-F beep. Bin

 

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.