Config.cache configuration file # vim Config.cache Libc_cv_forced_ Unwind=yes Libc_cv_c_cleanup=yes Libc_cv_arm_tls=yes #.. /configure--host= $TARGET--target= $TARGET--prefix= $TARGET _prefix--enable-add-ons--disable-profile--cache-file= Config.cache--with-binutils= $PREFIX/bin--with-headers= $TARGET _prefix/include cc= $TARGET-gcc cflags= "-G o2– March-armv6 " Note: The CC and cflags to modify will affect the subsequent compilation of
to set up Yum source.After installing CentOS, it is generally necessary to modify the Yum source to achieve the desired speed when installing the update RPM package. Domestic relatively fast has 163 source, Sohu source. Here is an example of a 163 source.1. CD/ETC/YUM.REPOS.D2. MV Centos-base.repo Centos-base.repo.backup3. wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo4. MV Centos6-base-163.repo Centos-base.repo5.yum Clean AllThis article is from the Linux learning blog, so be sure to
directory sequentially:
gmp-6.0.0 mpc-1.0.2 mpfr-3.1.2 ppl-1.1 cloog-0.18.1
Perform:
./configure--prefix=/home/charles/code/build_toolchain/toolchain make make
install
4. Create Bootstrap GCC
Create directory Build/gcc_first and enter into this directory to execute:
.. /.. /src/gcc-4.8.2/configure--build=i686-pc-linux-gnu --target=arm-linux-gnueabi--prefix=/home/charles/code/ Build_toolchain/toolchain
Scope extension
GCC support scope, in many aspects of C language can be used. One of these is the case statement in the Switch/case block. In a complex conditional structure, it is common to rely on nested IF statements to achieve the same results as listing 2 (see./linux/drivers/scsi/sd.c), but listing 2 is simpler. You can also use Switch/case to perform compiler optimizations by using a jump table implementation.Listing 2. Using Scope
operation is legal, for example, if there is such a command ASM ("Movl % 0, % 1"::"M"(FOO ),"M"(Bar); if you use the GCC-C-s option to compile the source file, then in the generated Assembly file, you will see that a command such as movl Foo and bar is generated, this is obviously incorrect. this error will be found later in the compilation check.Variable output: according to the specified output delimiter, the register content is output to a memory
):), compiled as:
#APP
MOVL Foo,eax
#NO_APP
MOVL Eax,bar
The statement is a bit weird, but it's a good representation of how GCC works.
Take a piece of code in ARCH/I386/KERNEL/APM.C as an example, let's compare what happens before and after they compile:
Compiled Code of source program
__ASM__ (
"Pushl%%edi/n/t"
"Pushl%%ebp/n/t"
"Lcall%%cs:/n/t"
"SetC%%al/n/t"
"Addl%1,%2/n/t"
"Popl%%ebp/n/t"
"Pop
static connections.
Below we attach the source code hello. C:
#include
Run the GCC-static -- verbose-fno-builtin hello. C, -- verbose command to enter the compilation details.-fno-builtin prevents the compiler from converting printf to puts. The result is as follows:
Using built-in specs.Collect_gcc = gccCollect_lto_wrapper =/usr/lib/GCC/x86_64-linux-gnu/4.6/Lto-wrapperTarget: x86_64-linux-gnuConfigure
How to compile a cross-platform gcc, the so-called cross-platform means that GCC compiles in a machine type but the compiled application is on a machine type, which we refer to as a cross-platform compilation of this article is reproduced in: http://preshing.com/ 20141119/how-to-build-a-gcc-cross-compiler/
How to build a
Download: http://ftp.gnu.org/gnu/gcc/gcc-4.5.1/gcc-4.5.1.tar.bz2Browse: HTTP://FTP.GNU.ORG/GNU/GCC/GCC-4.5.1/View Changes:http://gcc.gnu.org/gcc-4.5/changes.htmNow many programmers are using G
/lib/GCC/ARM-Linux/3.4.6/$ file.> done 7 uses the established cross compiler to compile the kernel (compile the linux-2.4.27-vrs1) error and handle 1.: Error: Invalid option 'short-load-bytes: set cflags_boot :=$ (APCS-y) $ (arch-y) $ (tune-y) in arch/ARM/makefile) -mshort-load-bytes-msoft-float-uarmcflags + =$ (APCS-y) $ (ar
/GCC
Or
Pacman-s GCC
Test
After installation we test:
Make-v
Displays a description similar to the following for installation success:
GNU make 4.2.1
for X86_64-pc-msys compile
Copyright (C) 1988-2016 free Software Foundation, Inc.
License: GPLV3+:GNU general Public License version 3rd or newer
Then test GCC:
The uses built-in specs. COLLECT_GCC=
~] # Find/-name arm-Linux-gcc
/Opt/ARM/toolschain/4.4.3/bin/ARM-Linux-gcc[Root @ localhost ~] #
We can see that the location of arm-Linux-GCC is consistent with the path set in environment variables.
Next, query the arm-Linux-GCC version.
[Root @ localhost bin] # arm-Linux-gcc
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.