Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

GCC optimized Linux analysis

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

The main content of this article is "GCC optimized Linux Analysis". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "GCC optimized Linux Analysis".

Software is useless if it cannot be run by a computer. And when it comes to dealing with run-time performance, even the most talented developers are at the mercy of the compiler-- because without a reliable compiler tool chain, you can't build anything important. The GNU Compiler Collection (GCC) provides a robust, mature, and high-performance tool to help you realize the full potential of your code. After decades of development by thousands of people, GCC has become one of the most respected compilers in the world. If you are not using GCC to build your application, you may have missed the best solution.

According to LLVM.org, GCC is "today's de facto standard open source compiler" [1] and the basis for building a complete system-starting with the kernel. GCC supports more than 60 hardware platforms, including ARM, Intel, AMD, IBM POWER, SPARC, HP PA-RISC and IBM Z, as well as a variety of operating environments, including GNU, Linux, Windows, macOS, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Solaris, AIX, HP-UX and RTEMS. It provides a highly compatible Cmax Cobb + compiler and supports popular C libraries such as GNU C Library (glibc), Newlib, musl and C libraries included in various BSD operating systems, as well as front ends for Fortran, Ada and GO languages. GCC can also act as a cross-compiler to create executable code for platforms other than the platform on which the compiler is running. GCC is the core component of the tightly integrated GNU tool chain, generated by the GNU project, which includes glibc, Binutils, and GNU debugger (GDB).

"my favorite GNU tool has always been GCC, the collection of GNU compilers. When development tools are very expensive, GCC is the second GNU tool and one that enables the community to write and build all other tools. This tool single-handedly changed the industry, leading to the birth of the free software movement, because a good, free compiler is a prerequisite for community software." -- Dave Neary for Red Hat open source and standards teams. [2]

Optimize Linux

As the default compiler for Linux kernel source code, GCC provides reliable, stable performance and additional extensions needed to build the kernel correctly. GCC is a standard component of popular Linux distributions, such as ArchLinux, CentOS, Debian, Fedora, openSUSE, and Ubuntu, where GCC is commonly used to compile components that support the system. This includes default libraries (such as libc, libm, libintl, libssh, libssl, libcrypto, libexpat, libpthread, and ncurses) used by Linux, which rely on GCC to provide reliability and high performance, and to enable applications and system programs to access Linux kernel functions. Many of the application packages included in the distribution are also built in GCC, such as Python, Perl, Ruby, nginx, Apache HTTP server, OpenStack, Docker, and OpenShift. Various Linux distributions use a large amount of code built by GCC to make up the kernel, libraries, and application software. For the openSUSE distribution, almost 100% of the native code is built by GCC, including 6135 source packages, 5705 shared libraries, and 38927 executables. This is equivalent to compiling 24540 source packages per week. [3]

The basic version of GCC included in the Linux distribution is used to create kernels and libraries that define the system application binary interface (ABI). Userspace developers can choose to download the latest stable version of GCC for advanced features, performance optimization, and usability improvements. The Linux distribution provides installation instructions or a pre-built tool chain for deploying the latest version of GCC and other GNU tools that help increase developer productivity and reduce deployment time.

Optimize the Internet

GCC is one of the core compilers widely used in embedded systems, which supports the development of software for the growing Internet of things. GCC provides a number of extended features that make it ideal for embedded system software development, including fine control using the compiler's built-in functions, # syntax, inline assembly, and application-centric command-line options. GCC supports a wide range of embedded architectures, including ARM, AMCC, AVR, Blackfin, MIPS, RISC-V, Renesas Electronics V850, NXP and Freescale Power processors, to generate efficient, high-quality code. The cross-compilation capabilities provided by GCC are critical to the community, and the prefabricated cross-compilation tool chain [4] is a major requirement. For example, the GNU ARM embedded tool chain is an integrated and validated software package that contains ARM embedded GCC compilers, libraries, and other tools needed for bare metal software development. These toolchains can be used to cross-compile popular ARM Cortex-R and Cortex-M processors on Windows, Linux, and macOS host operating systems, which have been loaded on tens of billions of Internet-enabled devices. [5]

GCC empowers cloud computing and provides a reliable development platform for software that needs to directly manage computing resources, such as database and Web service engines, as well as backup and security software. GCC is fully compatible with C++ 11 and C++ 14, and provides experimental support for C++ 17 and C++ 2a [6]. It can create object code with excellent performance and provide reliable debugging information. Some examples of applications that use GCC include: the MySQL database management system, which requires Linux's GCC [7]; the Apache HTTP server, which recommends the use of GCC [8]; and Bacula, an enterprise network backup tool that requires GCC. [9]

Optimize everything

For the research and development of scientific code used in high performance computing (HPC), GCC provides mature C, C++, and Fortran front ends, as well as support for OpenMP and OpenACC API for instruction-based parallel programming. Because GCC provides portability across computing environments, it makes it easier for code to be tested on a variety of new and traditional client and server platforms. GCC provides full OpenMP 4.0 support for C, C++ and Fortran compilers, and OpenMP 4.5 full support for C and C++ compilers. For OpenACC, GCC supports most of the 2.5 specifications and performance optimizations, and is the only non-commercial, non-academic compiler that provides OpenACC support.

Code performance is an important parameter for this community, and GCC provides a solid performance foundation. A paper published by Colfax Research in November 2017 assessed the speed at which the C++ compiler compiles code in parallelization using the OpenMP 4.x instruction and runs after compilation. Figure 1 depicts the relative performance of the kernel when different compilers compile and use a single thread to run the kernel. The performance value is normalized, and the performance of Globe + is 1.0.

Figure 1 shows the relative performance of each kernel compiled by different compilers. (single thread, the higher the better).

His paper concluded: "the GNU compiler also did well in our tests. Glossy + generates the second fastest code in three of the six cases, and is one of the fastest compilers in terms of compile time." [10]

Who is using GCC?

Of the 6000 developers surveyed in JetBrains's 2018 developer Ecology Survey, 66% of C++ programmers and 73% of C programmers regularly use GCC. [11] the following is a brief introduction to the advantages of GCC that make it so popular in the developer community.

◈ provides support for the broadest range of hardware and operating environments for developers who need to write code for a variety of new and legacy computing platforms and operating environments. The compilers provided by hardware vendors mainly focus on the support of their products, while other open source compilers are limited in terms of the hardware and operating systems they support. [12]

◈ has a variety of GCC-based pre-built toolchains, which are particularly attractive to embedded system developers. This includes the GNU ARM embedded tool chain and the 138precompiled cross-compiler tool chains available on the Bootlin website. [13] while other open source compilers, such as Clang/LLVM, can replace GCC in the existing cross-compilation toolchain, these toolsets require developers to completely rebuild. [14]

◈ GCC provides reliable and stable performance to application developers through a mature compiler platform. The article "benchmark testing of compilers on AMD EPYC platforms using GCC 8 Accord 9 and LLVM Clang 6 Accord 7 compilers" provides the results of 49 benchmarks whose compilers run at three optimization levels. GCC 8.2 RC1 using the-O3-march=native level ranked first in 34% of the time, while LLVM Clang 6.0 won second place in 20% of the time at the same optimization level. [15]

◈ GCC provides an improved diagnostic method for compilation and debugging, and provides accurate and useful information for run-time debugging. GCC is tightly integrated with GDB, and GDB is a mature and full-featured tool that provides "non-stop" debugging that stops a single thread at a breakpoint.

◈ GCC is a well-supported platform with an active and responsible community that supports the current version and the previous two. Due to the annual release plan, this provides two years of support for a version.

GCC: still continuing to optimize

GCC continues to move forward as a world-class compiler. The latest version of GCC, released in July 2018, adds hardware support for the upcoming Intel CPU, more ARM CPU, and improves the performance of AMD's ZEN CPU. Initial support for C17 has been increased, and preliminary work has also been carried out on Clover 2A. Diagnostics continued to be enhanced, including better launch diagnostics, improved positioning, positioning range, and repair tips, especially at the front end of C++. Red Hat's David Malcolm wrote a blog in March 2018 that outlines usability improvements in GCC 8. [17]

New hardware platforms continue to rely on GCC toolchains for software development, such as RISC-V, a free and open ISA that is of interest to machine learning, artificial intelligence (AI) and the Internet of things market segment. GCC remains a key component in the continuous development of Linux systems. The Clear Linux project for Intel architecture, an emerging release built for cloud, client, and Internet of things use cases, provides a good example of how to use and improve GCC compiler technology to improve the performance and security of Linux-based systems. GCC is also used for Microsoft Azure Sphere application development, a Linux-based Internet of things application operating system that initially supported the ARM-based MediaTek MT3620 processor. The GCC is also a core component of the raspberry pie's Windows tool chain in nurturing the next generation of programmers, a low-cost embedded board that runs Debian-based GNU/Linux to promote basic computer science teaching in schools and developing countries.

GCC was first released by Richard Stallman, founder of the GNU project, on March 22, 1987, and is considered a major breakthrough because it is the first portable ANSI C optimized compiler released as free software. GCC is maintained by a community of programmers from around the world under the guidance of a steering committee to ensure extensive and representative oversight of the project. One of its strengths is GCC's community approach, which forms a large and diverse community of developers and users who contribute to and support the project. According to Open Hub, "GCC is one of the largest open source teams in the world, ranking in the top 2% of all project teams on Open Hub." [18]

There has been a lot of discussion about the licensing of GCC, most of which is confusion rather than inspiration. GCC is released under GNU General Public license (GPL) version 3 or later, with the exception of the runtime library. This is a left-hand license, which means that derivative works can only be distributed under the same license terms. GPLv3 aims to protect GCC from becoming proprietary software and requires that changes to GCC code be made freely and publicly. For the "end user", this compiler is exactly the same as other compilers; using GCC makes no difference to any license you choose for your own code. [19]

At this point, I believe you have a deeper understanding of "GCC optimized Linux Analysis". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report