
Red Hat Developer Tools 1 Using LLVM 11.0.0 Toolset Installing and using LLVM 11.0.0 toolset Last Updated: 2021-06-03 Red Hat Developer Tools 1 Using LLVM 11.0.0 Toolset Installing and using LLVM 11.0.0 toolset Eva-Lotte Gebhardt [email protected] Zuzana Zoubkova [email protected] Olga Tikhomirova [email protected] Peter Macko Kevin Owen Vladimir Slavik Legal Notice Copyright © 2021 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project. The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community. All other trademarks are the property of their respective owners. Abstract LLVM Toolset is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. This Using LLVM Toolset guide provides an overview of this product, explains how to invoke and use different versions of LLVM tools, and links to resources with more in-depth information. Table of Contents Table of Contents .M . A. .K . I.N . .G . .O . P. .E . N. S. .O . U. .R . C. .E . .M . .O . R. .E . .I N. .C . L. .U . S. .I V. .E . .4 . .C . H. .A . P. .T .E . R. 1.. .L . L. .V . M. 5. 1.1. ABOUT LLVM TOOLSET 5 1.2. COMPATIBILITY 5 1.3. GETTING ACCESS TO LLVM TOOLSET ON RED HAT ENTERPRISE LINUX 7 6 Prerequisites 6 Procedure 6 Additional Resources 7 1.4. INSTALLING LLVM TOOLSET 7 1.4.1. Installing CMake on Red Hat Enterprise Linux 8 1.4.1.1. CMake installable documentation 8 1.4.2. Installable documentation 8 1.5. ADDITIONAL RESOURCES 8 Online documentation 8 .C . H. .A . P. .T .E . R. 2. U. .S . I.N . .G . .C . L. .A . N. .G . 9. 2.1. COMPILING A C SOURCE FILE TO A BINARY FILE 9 2.2. COMPILING A C SOURCE FILE TO AN OBJECT FILE 10 2.3. LINKING C OBJECT FILES TO A BINARY FILE 10 2.4. USING THE CLANG INTEGRATED ASSEMBLER 10 2.5. RUNNING A C PROGRAM 11 2.6. ADDITIONAL RESOURCES 11 Installed documentation 11 Online documentation 11 See Also 11 .C . H. .A . P. .T .E . R. 3. U. S. I.N . .G . .C . L. .A . N. .G . .+ .+ . 1. 2. 3.1. COMPILING A C++ SOURCE FILE TO A BINARY FILE 12 3.2. COMPILING A C++ SOURCE FILE TO AN OBJECT FILE 12 3.3. LINKING C++ OBJECT FILES TO A BINARY FILE 12 3.4. RUNNING A C++ PROGRAM 13 3.5. ADDITIONAL RESOURCES 14 Installed documentation 14 Online documentation 14 See Also 14 .C . H. .A . P. .T .E . R. 4. .L .L . D. .B . 1. 5. 4.1. PREPARING A PROGRAM FOR DEBUGGING 15 4.2. RUNNING LLDB 15 4.3. LISTING THE SOURCE CODE 16 4.4. USING BREAKPOINTS 17 Setting a New Breakpoint 17 Listing Breakpoints 17 Deleting Existing Breakpoints 18 4.5. STARTING EXECUTION 18 4.6. DISPLAYING CURRENT PROGRAM DATA 19 4.7. CONTINUING EXECUTION AFTER A BREAKPOINT 19 4.8. ADDITIONAL RESOURCES 21 Online documentation 21 See also 21 1 Red Hat Developer Tools 1 Using LLVM 11.0.0 Toolset .C . H. .A . P. .T .E . R. 5. C. .O . .N . T. .A . I.N . E. .R . .I M. A. .G . E. .S . .W . .I T. .H . .L .L . V. .M . T. O. O. .L . S. .E .T . 2. 2. 5.1. USING UBI REPOSITORIES 22 5.2. EXAMPLE: BUILDING A CONTAINER IMAGE OF LLVM ON RHEL 8 USING A DOCKERFILE 22 5.3. EXAMPLE: BUILDING A CONTAINER IMAGE OF LLVM ON RHEL 7 USING A DOCKERFILE 22 5.4. ADDITIONAL RESOURCES 23 .C . H. .A . P. .T .E . R. 6. .C . H. .A . N. .G . .E .S . .I N. L. .L . V. .M . .1 .1 ..0 . ..0 . .T . O. .O . .L .S . E. .T . .2 . 4. 2 Table of Contents 3 Red Hat Developer Tools 1 Using LLVM 11.0.0 Toolset MAKING OPEN SOURCE MORE INCLUSIVE Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message . 4 CHAPTER 1. LLVM CHAPTER 1. LLVM 1.1. ABOUT LLVM TOOLSET LLVM Toolset is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. It provides the LLVM compiler infrastructure framework, the Clang compiler for the C and C++ languages, the LLDB debugger, and related tools for code analysis. LLVM Toolset is distributed as a part of Red Hat Developer Tools for Red Hat Enterprise Linux 7. LLVM Toolset is available as a module for Red Hat Enterprise Linux 8. The following components are available as a part of LLVM Toolset: Table 1.1. LLVM Components Name Version Description clang RHEL 7 — 11.0.1 An LLVM compiler front end for C RHEL 8 — 11.0.0 and C++. lldb RHEL 7 — 11.0.1 A C and C++ debugger using RHEL 8 — 11.0.0 portions of LLVM. compiler-rt RHEL 7 — 11.0.1 Runtime libraries for LLVM. RHEL 8 — 11.0.0 llvm RHEL 7 — 11.0.1 A collection of modular and RHEL 8 — 11.0.0 reusable compiler and toolchain technologies. libomp RHEL 7 — 11.0.1 A library for utilization of Open RHEL 8 — 11.0.0 MP API specification for parallel programming. lld RHEL 7 — 11.0.1 An LLVM linker. RHEL 8 — 11.0.0 python-lit RHEL 7 — 0.11.1 A software testing tool for LLVM- RHEL 8 — 0.11.0 and Clang-based test suites. IMPORTANT LLVM Toolset for Red Hat Enterprise Linux 7 also provides CMake as a separate package. On Red Hat Enterprise Linux 8, CMake is available in the system repository. For more information on how to install CMake, see Section 1.4, “Installing LLVM Toolset”. 1.2. COMPATIBILITY LLVM Toolset is available for Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8 on the following architectures: 5 Red Hat Developer Tools 1 Using LLVM 11.0.0 Toolset AMD and Intel 64-bit architectures The 64-bit ARM architecture (Only RHEL 8) IBM Power Systems, Little Endian IBM Power Systems, Big Endian (Only RHEL 7) 64-bit IBM Z 1.3. GETTING ACCESS TO LLVM TOOLSET ON RED HAT ENTERPRISE LINUX 7 This chapter lists the steps to perform before installing LLVM Toolset on a Red Hat Enterprise Linux 7 system. Complete the following steps to attach a subscription that provides access to the repository for Red Hat Developer Tools, and then enable the Red Hat Developer Tools and Red Hat Software Collections repositories. Prerequisites Verify that wget is installed on your system. The tool is available from the default Red Hat Enterprise Linux repositories. To install it, run the following command as root: # yum install wget Procedure 1. Get the latest subscription data from the server: # subscription-manager refresh 2. Use the following command to register the system: # subscription-manager register You can also register the system by following the appropriate steps in Registering and Unregistering a System in the Red Hat Subscription Management document. 3. Display a list of all subscriptions that are available for your system and identify the pool ID for the subscription: # subscription-manager list --available This command displays the subscription name, unique identifier, expiration date, and other details related to it. The pool ID is listed on a line beginning with Pool ID. 4. Attach the subscription that provides access to the Red Hat Developer Tools repository. Use the pool ID you identified in the previous step. # subscription-manager attach --pool=<appropriate pool ID from the subscription> 5. Verify the list of subscriptions attached to your system: # sudo subscription-manager list --consumed 6 CHAPTER 1. LLVM 6. Enable the rhel-7-variant-devtools-rpms repository: # subscription-manager repos --enable rhel-7-variant-devtools-rpms Replace variant with the Red Hat Enterprise Linux system variant ( server or workstation).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages28 Page
-
File Size-