GNU Tool Set

Source: Internet
Author: User
Tags memory usage sort split
GNU Assembler (gas)

The GNU assembler (known as gas) is the most popular assembler in the UNIX environment.

Unlike most other development packages, the GNU assembler is not published in a separate package. It is bundled with other development software in the GNU Binutils package. The following programs are included in the Binutils package:

Addr2line convert address to file name and line number

AR Create, modify, and expand file archives

As to assemble assembly language code into target code

C++filt to restore C + + symbol filters

GPROF program for displaying program profile information

LD converts the target code file to the connector of the executable file

Nlmconv Convert the target code to the NetWare Loadable module format

NM lists the symbols in the destination file

Objcopy copying and translating target files

Objdump displaying messages from the target file

Ranlib index to generate archive file contents

Readelf displaying messages from the destination file in elf format

Size lists the length of the destination file or archive file

strings displaying printable strings in the destination file

Strip Discard Symbols

Windres compiling Microsoft Windows resource files One, gas use method

As [-a[cdhlns][=file]] [-d] [--defsym Sym=val]

[-F] [--gstabs] [--gstabs+] [--gdwarf2] [--help]

[-I. DIR] [-j] [-K] [-l]

[--listing-lhs-width=num] [--listing-lhs-width2=num]

[--listing-rhs-width=num] [--listing-cont-lines=num]

[--keep-locals] [-O objfile] [-R] [--statistics] [-V]

[-version] [--version] [-W] [--warn] [--fatal-warnings]

[-W] [-X] [-Z] [--target-help] [Target-options]

[--|files ...] second, detailed parameters

-a specifies which manifests are included in the output

-D contains it for backwards compatibility but is ignored

--defsym defining symbols and values before compiling the source code

-F Quick Assembly, skipping annotations and whitespace

--gstabs contains debug information for each line of source code

--gstabs+ contains specialized GDB debug information

-i specifies to search for directories containing files

-j no warning with sign overflow

-K contains it for backwards compatibility but is ignored

-L save local symbols in symbol table

--listing-lhs-width Setting the maximum width of the output data column

--listing-lhs-width2 set the maximum width of the output data column for contiguous rows

--listing-rhs-width Setting the maximum width of the input source line

--listing-cont-lines sets the maximum number of rows that the input single line outputs in the list

-o Specifies the name of the output destination file

-R merging data segments into text segments

--statistics show the maximum space used by the assembly hull Total time

-V Displays the version number of AS

-W does not display a warning message

--use standard input for source files

GNU Connector (referred to as LD)

The GNU Connector ld is used to link the target code file to an executable file, or to a library file. Link is actually the completion of four aspects of the work: storage allocation, symbol management, libraries, relocation.

LD can identify a linker command language linker scriopt file to explicitly control the linking process. With BFD (Binary format Description) library, LD can read and manipulate COFF (Common Object file format), ELF (executable and linking format), A.out the target file in various formats. 1. LD command Format

The command format for LD is as follows:

LD [-o output] objfile ...

[-aarchitecture] [-B Input-format] [-bstatic]

[-bdynamic] [-bsymbolic] [-C Commandfile] [--cref]

[-D|-DC|-DP]

[-defsym Symbol=expression] [--demangle]

[--no-demangle] [-E Entry] [-embedded-relocs] [-E]

[-export-dynamic] [-F name] [--auxiliary name]

[-F name] [--filter name] [-format Input-format]

[-G] [-G size] [-H name] [-soname name] [--help]

[-I.] [-lar] [-lsearchdir] [-M] [-map Mapfile]

[-M emulation] [-n|-n] [-noinhibit-exec]

[-no-keep-memory] [-no-warn-mismatch] [ -0level]

[-oformat Output-format] [-R FileName] [-relax]

[-r|-ur] [-rpath directory] [-rpath-link directory]

[-S] [-S] [-shared] [-sort-common]

[-split-by-reloc Count] [-split-by-file]

[-T Commandfile]

[--section-start sectionname=sectionorg]

[-ttext textorg] [-tdata dataorg] [-tbss bssorg]

[-T] [-U sym] [-V] [-V] [--verbose] [--version]

[-warn-common] [-warn-constructors]

[-WARN-MULTIPLE-GP] [-warn-once]

[-warn-section-align] [--whole-archive]

[--no-whole-archive] [--wrap symbol] [-X] [-X]

2. Detailed Parameters

-b Specifies the format of the target code input file

-bstatic only use static libraries

-bdynamic only use dynamic libraries

-bsymbolic binding references to global symbols in a shared library

-c read instruction from specified command file

-cref Creating cross-reference tables

-D sets a space to the universal symbol even if the relocatable output is specified

-defsym creating the specified global symbol in the output file

--demangle to restore symbol names in error messages

-e uses the specified symbol as the chef execution point for the program

-E for Elf format files, add all symbols to the dynamic symbol table

-F for Elf format shared object, set dt_auxiliary name

-F for Elf format shared object, Dt_tilter name

-FORMAT Specifies the format of the target code input file (same as-B)

-G is ignored. Used to provide compatibility with other tools

-H for Elf format shared object, set Dt_soname name

-I perform an incremental connection

-L ADD the specified archive file to the list of files to be connected

-L ADD the specified path to the search for the list of subdirectories

-m display connection mappings for diagnostic purposes

-map creating the specified file to contain the connection mappings

-m simulates the specified connector

-n Specifies read/write text and data segments

-N Set Text field to read-only

-noinhibit-exec generate output file even if a non-fatal connection error occurs

-no-keep-memory Optimizing connections for memory usage

-no-warn-mismatch allow connection of mismatched target files

-O generates an optimized output file

-o Specifies the name of the output file

-oformat binary format of the specified output file

-R reads the symbol name and address from the specified file

-R generates relocatable output (called Partial connections)

-rpath adding the specified directory to the run-time Library search Path

-rpath-link Specifies the directory where the search runtime shares the library

-S ignores debugger symbol information from output file

-S ignores all symbolic information from the output file

-shared Creating a shared library

-sort-common symbols are not sorted by length in the output file

-split-by-reloc creates additional segments in the output file at the specified length

-split-by-file create additional segments in the output file for each target file

--section-start the specified segment at the address specified in the output file

-t Specifies the command file (same as-c)

-ttext uses the specified address as the starting point for the text segment

-tdata using the specified address as the starting point for the data segment

-TBSS using the specified address as the starting point of the BSS segment

-T displays their names when processing input files

-U forces the specified symbol to be used as undefined symbol in the output file

-warn-common warns when a generic symbol is combined with another universal symbol

-warn-constructors if no global constructor is used, a warning is issued

-warn-once only one warning is issued for each undefined symbol

-warn-section-align issue a warning if the output segment address has been altered in order to align

--whole-archive for the specified archive file, include all files in the archive

-X Delete all local temporary symbols

-X Delete all local symbols 3, common options

-B Target Sets the file format of the destination file
-e address sets the start of the destination file
-eb Link Big-endian target file
-el Link Small-endian target file
-l LIBNAME The library file to be linked when the program is created (for example, if a library is test, it can be-ltest)
-L DIRECTORY Search for file paths when searching for library files to link
-o file sets the name of the output files
-S removes all symbol information from the output file
-s removes debug symbol information from the output file
-T FILE reads the link description script to determine the location address of the symbol, etc.
-V Output LD version information
-X removes all local symbolic information
-x removes temporary local symbol information, which is set by default
-bstatic Create an output file link to a static link library
-bdynamic Create an output file link dynamic link library
-TBSS address to set the start of section BSS
-tdata address Setting the start of section data
-ttext address set the start of section text

GNU compiler (called GCC)

GCC can compile many different high-level languages. including C, C + +, objective-c, Fortran, Java, Ada and so on. one, gcc command format

The command line format for GCC is as follows:

GCC [-c|-s|-e] [-std=standard]

[-G] [-PG] [-olevel]

[-wwarn ...] [-pedantic]

[-idir ...] [-ldir ...]

[-dmacro[=defn] ...] [-umacro]

[-foption ...] [-mmachine-option ...]

[-o outfile] infile ...

second, detailed parameters

-C compile or assemble the code, but do not connect

-S is compiled and stopped, but not compiled

-E is stopped after preprocessing, but not compiled

-o Specifies the output file name to use

-V Displays the commands used in each compilation phase

-STD Specifies the language standard used

-G Generate Debug information

-PG Generate gprof additional code to use for making profiles

-O Optimized executable code

-W Set compiler warning message level

-pedantic release of mandatory diagnostic checklist according to C standard

-i specifies the directory containing the files

-l Specifies the directory of the library file

-D macros used in pre-defined source code

-U cancels any defined macros

-f Specifies options for controlling compiler behavior

-m specifies hardware-related options

GNU Debugger (called gdb) One, gdb command-line format

GDB command-line format:

GDB [-NX] [-Q] [-batch] [-cd=dir] [-F] [-B bps] [-tty=dev]

[-S Symfile] [-E Prog] [-se Prog] [-C Core] [-X Cmds] [-D dir]

[Prog[core|procid]] second, the GDB parameter detailed

-B line speed of the serial interface when setting up remote debugging

-batch running in batch mode

-c Specifies the core dump file to analyze

-CD Specifying working directory

-d Specifies the directory to search for source files

-e Specifies the file to execute

-F output File name and line number in standard format when debugging

-nx do not execute commands from the. gdbinit file

-Q Quiet mode-no output introduced

-s Specifies the file name of the symbol

-se specifying the name of the symbol and drug execution

-tty setting standard input and output devices

-X Executes the GDB command from the specified file , gdb command

The GDB command is as follows:

Break sets a breakpoint in the source code to stop execution

Watch sets the watch to stop execution when a variable reaches a specific value.

Info Observing System elements such as registers, stacks, and memory

X Check memory location

Print Display variable values

Run starts the execution of the program within the debugger

List lists the specified functions or rows

Next command in the execution of the program

The next instruction in the Step execution program

Cont resumes execution from the stopped position

Until runs the program until it reaches the specified source code line (or larger)

GNU objdump Program

Programmers can use the Objdump program to view the script generated by the compiler in the target code file. The program not only can display assembly language code, but also can display the generated original script.

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.