Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset

Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset

Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset Installing and using the LLVM 10.0.1 toolset Last Updated: 2021-04-07 Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset Installing and using the LLVM 10.0.1 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 is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. The Using LLVM provides an overview of this product, explains how to invoke and use the LLVM versions of the tools, and links to resources with more in-depth information. Table of Contents Table of Contents .C . H. .A . P. .T .E . R. 1.. .L . L. .V . M. .4 . 1.1. ABOUT LLVM TOOLSET 4 1.2. COMPATIBILITY 4 1.3. GETTING ACCESS TO LLVM TOOLSET ON RED HAT ENTERPRISE LINUX 7 5 Prerequisites 5 Procedure 5 Additional Resources 6 1.4. INSTALLING LLVM TOOLSET 6 1.4.1. Installing CMake on Red Hat Enterprise Linux 7 1.4.1.1. CMake installable documentation 7 1.4.2. Installable documentation 7 1.5. ADDITIONAL RESOURCES 7 Online documentation 7 .C . H. .A . P. .T .E . R. 2. C. .L . A. .N . G. 8. 2.1. USING CLANG 8 2.1.1. Compiling a C source file to a binary file 8 2.1.2. Compiling a C source file to an object file 9 2.1.3. Linking C object files to a binary File 9 2.1.4. Using the clang Integrated Assembler 9 2.2. RUNNING A C PROGRAM 10 2.3. USING CLANG++ 10 2.3.1. Compiling a C++ Source File to a Binary File 10 2.3.2. Compiling a C++ source file to an object file 11 2.3.3. Linking C++ object files to a binary file 11 2.4. RUNNING A C++ PROGRAM 12 2.5. ADDITIONAL RESOURCES 12 Installed documentation 12 Online documentation 13 See Also 13 .C . H. .A . P. .T .E . R. 3. L. .L . D. .B . 1.4 . 3.1. PREPARING A PROGRAM FOR DEBUGGING 14 3.2. RUNNING LLDB 14 3.3. LISTING THE SOURCE CODE 15 3.4. USING BREAKPOINTS 16 Setting a New Breakpoint 16 Listing Breakpoints 16 Deleting Existing Breakpoints 17 3.5. STARTING EXECUTION 17 3.6. DISPLAYING CURRENT PROGRAM DATA 18 3.7. CONTINUING EXECUTION AFTER A BREAKPOINT 18 3.8. ADDITIONAL RESOURCES 20 Online documentation 20 See also 20 .C . H. .A . P. .T .E . R. 4. .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. .1 . 4.1. IMAGE CONTENTS 21 4.2. ACCESSING THE IMAGES 21 4.3. USING AS BUILDER IMAGES WITH SOURCE-TO-IMAGE 21 4.4. ADDITIONAL RESOURCES 22 1 Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset .C . H. .A . P. .T .E . R. 5. C. .H . .A . N. .G . E. .S . .I N. L. .L .V . M. .1 .0 .. .0 .. 1. .T . O. .O . .L .S . E. .T . .2 . 3. 2 Table of Contents 3 Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset 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 10.0.1 An LLVM compiler front end for C and C++. lldb 10.0.1 A C and C++ debugger using portions of LLVM. compiler-rt 10.0.1 Runtime libraries for LLVM. llvm 10.0.1 A collection of modular and reusable compiler and toolchain technologies. libomp 10.0.1 A library for utilization of Open MP API specification for parallel programming. lld 10.0.1 An LLVM linker. python-lit 0.10.0 A software testing tool for LLVM- 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: The 64-bit Intel and AMD architectures 4 CHAPTER 1. LLVM IBM Power Systems, little endian 64-bit IBM Z IBM Power Systems, big endian (only RHEL 7) The 64-bit ARM architecture (only RHEL 8) 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. Enable the rhel-7-variant-devtools-rpms repository: 5 Red Hat Developer Tools 1 Using LLVM 10.0.1 Toolset # subscription-manager repos --enable rhel-7-variant-devtools-rpms Replace variant with the Red Hat Enterprise Linux system variant ( server or workstation). Consider using Red Hat Enterprise Linux Server to access the widest range of the development tools. 7. Enable the rhel-variant-rhscl-7-rpms repository: # subscription-manager repos --enable rhel-variant-rhscl-7-rpms Replace variant with the Red Hat Enterprise Linux system variant ( server or workstation). 8. Add the Red Hat Developer Tools GPG key to your system: # cd /etc/pki/rpm-gpg # wget -O RPM-GPG-KEY-redhat-devel https://www.redhat.com/security/data/a5787476.txt # rpm --import RPM-GPG-KEY-redhat-devel Once the subscription is attached to the system and the repositories are enabled, install LLVM Toolset as described in Section 1.4, “Installing LLVM Toolset”. Additional Resources For more information on how to register your system using Red Hat Subscription Management and associate it with subscriptions, see the Red Hat Subscription Management collection of guides. 1.4. INSTALLING LLVM TOOLSET LLVM Toolset is distributed as a collection of RPM packages that can be installed, updated, uninstalled, and inspected by using the standard package management tools that are included in Red Hat Enterprise Linux.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    27 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us