Build, Run, & Analyze Applications On Multiple Versions of...
Transcript of Build, Run, & Analyze Applications On Multiple Versions of...
RED HAT DEVELOPER TOOLSETBuild, Run, & Analyze Applications OnMultiple Versions of Red Hat Enterprise Linux
Dr. Matt NewsomeSenior Engineering Manager, Tools
v1.4
7
Toolchain Support
RHEL 5 RHEL 6
☑ VERY HIGH STABILITY
☑ LIMITED NEW FEATURES
☑ 10 YEARS OF SUPPORT
RHEL 7RC Fedora
Building with RHEL tools (1)
RHEL 5gcc xApplication
Sources
RHEL 6gcc yBranchedSources
BUILD
BUILD
DEPLOY
DEPLOY
Building with RHEL tools (2)
RHEL 5.y+2gcc x.3Sources x.3
BUILD DEPLOY
RHEL 5.y+1gcc x.2Sources x.2
gcc x.1ApplicationSources x.1
RHEL 5.y
RHEL 6.y+2gcc y.3Sources y.3
BUILD DEPLOY
RHEL 6.y+1gcc y.2Sources y.2
gcc y.1ApplicationSources y.1
RHEL 6.y
What is Red Hat Developer Toolset?• The latest stable tools for developers(Compiler, IDE, performance and version control tools)
• An extra set - does not replace your existing RHEL tools
RHEL 5
RHEL 6
• Tools run on RHEL 5 & 6
• Applications built with Developer Toolset also run on RHEL 5 & 6
• Applications built with Developer Toolset 2.1 today on RHEL 6 also run on RHEL 7 RC
• Available through Developer Subscriptions and Partner Programs
• v2.1 GA available today
RHEL 7RC
Supported Architectures and Languages
EL
RHEL5 & 6
IA-32x86-64
C, C++& Fortran
RHEL
SOFTWARE COLLECTIONS
SOFTWARE COLLECTIONS
•Structure for delivering software outside OS
•/opt (per Filesystem Hierarchy Standard)
•Different filesystem root per application version
•Activated via script
•Allows multiple versions installed in parallel
•Independent lifecycle from RHEL
Developer Toolset is a Software Collection
/
usr bin gcc
etc.
•Special Invocation
•Separate tools, not default
•Lifecycle independent from RHEL
RHEL x.ySystem Compiler
lib libc.so
etc.
Internal script invokedvia “scl” utility
...root
enable
dts-2.x
opt rh root usr bin gcc
etc.enable
dts-1.x
Developer ToolsetCompiler
VERSION CONTROL
What’s in Developer Toolset v2.1?
CORE TOOLS
GCC 4.8 GDB 7.6.1 BINUTILS 2.23.52
DEBUG & PERFORMANCE TOOLS
SYSTEMTAP 2.1
ELFUTILS-0.157DWZ
OPROFILE 0.9.8
SOFTWARE COLLECTIONS
ECLIPSE IDE 4.3.1 KEPLER (RHEL 6 ONLY)
DYNINST 8.0 MEMSTOMPSTRACE 4.7
VALGRIND 3.8.1
GIT 1.8.4
VERSION CONTROL
What’s in Developer Toolset v2.1?
CORE TOOLS
GCC 4.8 GDB 7.6.1 BINUTILS 2.23.52
DEBUG & PERFORMANCE TOOLS
SYSTEMTAP 2.1
ELFUTILS-0.157DWZ
OPROFILE 0.9.8
SOFTWARE COLLECTIONS
ECLIPSE IDE 4.3.1 KEPLER (RHEL 6 ONLY)
DYNINST 8.0 MEMSTOMPSTRACE 4.7
VALGRIND 3.8.1
UPDATED IN 2.1GIT 1.8.4
NEW IN 2.1
KEY:
Updated Compiler: GCC 4.8
C++11• Leading C++11 language support• Guaranteed atomic memory accesses
LRA• Brand new “Local Register Allocator”• Contributed by Red Hat
Performance• Compile extremely large functions faster and using less memory
HTM• Simpler concurrency• Atomic execution of source instruction groups
TOOLSET v2.x
TOOLSET v1.x
Developer Toolset Life Cycle
FIRST YEAR
1.x CRITICAL FIXES AND SECURITY UPDATES
1.x EN
D O
F L
IFE
v1.0
SECOND YEAR
v1.1
v2.0
v2.12.x CRITICAL FIXES
& SECURITY UPDATES
2.x E
ND
OF
LI F
E
MID
- YE
AR
MID
- YE
AR
•Annual major
•Mid-year minor
•Async updates
Usage
• Advanced
# rhn-channel --add --channel=rhel-x86_64-workstation-dts-6# yum-config-manager --enable rhel-server-dts-6-rpms{ }# yum install devtoolset-2
scl enable devtoolset-2 'gcc ...'Click the Developer Toolset Eclipse 2.x Eclipse icon{ }
scl enable devtoolset-2 'bash ...'
• Usage
• SubscriptionEIT
HE
RE
ITH
ER
• Installation
memcpy() calls with overlapping arguments
#include <string.h>main() { char src[] = "text-to-copy"; char *dest = src + 2; // call memcpy() with overlapping args memcpy((void*)dest,(void*)src,3); return 0;}
[mattn@rhel]$ gcc memcpy_bad.c -o memcpy_bad[mattn@rhel]$ ./memcpy_bad Segmentation fault (core dumped)
memstomp to the rescue!
[mattn@rhel]$ memstomp ./memcpy_badmemstomp: 0.1.4 successfully initialized for process memcpy_bad (pid 28195).memcpy(dest=0x7fff103cc1c2, src=0x7fff103cc1c0, bytes=3) overlap for memcpy_bad(28195) /.../libmemstomp.so(+0x10a7) [0x7fdb4760a0a7] ./memcpy_bad(main+0x45) [0x400795] /lib64/libc.so.6(__libc_start_main+0xfd) [0x357fe1ed1d] ./memcpy_bad() [0x400669]
• Indicates overlapping arguments to memcpy()
• ...but also indicates where that call occurs
[mattn@rhel]$ memstomp ./memcpy_bad
memcpy() calls with overlapping arguments fixed
#include <string.h>main() { char src[] = "text-to-copy"; char *dest = src + 5; // no longer overlaps memcpy((void*)dest,(void*)src,3); return 0;}
[mattn@rhel]$ gcc memcpy_fixed.c -o memcpy_fixed[mattn@rhel]$ ./memcpy_fixed[mattn@rhel]$ memstomp ./memcpy_fixedmemstomp: 0.1.4 successfully initialized for process memcpy_fixed (pid 31322).
TOOLSET
GCC 4.8
GCC 4.7
Linkage
RHEL
glibc
libgomp
libstdc++
libgcc
APPLICATION
NewerSymbols
DynamicLinkage
StaticLinkage
BUILD
Regular Linkage with RHEL Toolchain
Traditional RHEL Application
libstdc++(C++ Library)
glibc(C Library)
libgcc(conversions, etc.)
libgomp(OpenMP)
symbol symbolsymbol symbol
dynamic linkage
V2
Bugs in glibc can be fixed via errata updatesto base Red Hat Enterprise Linux
libstdc++ (C++ Library)
v2
Static Linkage of Newer Symbols
Application Built with Developer Toolset
glibc(C Library)
libgcc(conversions, etc.)
libgomp(OpenMP)
symbol symbolsymbol symbol
dynamiclinkage
v2
newer symbol newer symbol
Archive of newer libstdc++ symbols (.a)
static linkage
.o .o
● Some DTS symbols are statically linked● RHEL errata updates won't change your binaries
Security Implications
Application Built with Developer Toolset symbol symbolsymbol symbol newer symbol newer symbol
Archive of newer libstdc++ symbols (.a)
.o .o
Statically linked symbols still contain bugApplications must be rebuilt to fix this
REBUILD
Low Risk
Alerts via Security Advisory
Common Questions (1)
•How do I make Developer Toolset gcc/gdb the default?
•How do I use Developer Toolset gcc to...X?
scl enable devtoolset-2 'bash ...'
scl enable devtoolset-2 'X'
Common Questions (2)•Which RHEL versions can I run toolset on?
•Which RHEL versions can I run toolset-built apps on?
Common Questions (3)• Gotchas and issues?
● Release notes spell these out
• Main ones to be aware of● C++11, TM are experimental, use with caution or use C++98 ● Some base RHEL errata are required for all features● Forwards only (don't build on RHEL6 and run on RHEL5)● Forwards only (don't build on rhel-6.5 and run on rhel-6.3)● Intended for userland development, not kernel rebuilding
Access a subscription that includes Developer Toolset
Red Hat Developer Toolset March 2014ENTERPRISEPROFESSIONAL
RED HAT ENTERPRISE LINUX DEVELOPER SUBSCRIPTIONS
RED HAT ENTERPRISE LINUX DEVELOPER WORKSTATION √√
√ √
RED HAT ENTERPRISE LINUX DEVELOPER SUITE Available Only Self Support
RED HAT ENTERPRISE LINUX NOT-FOR-RESALE SUBSCRIPTIONS Available Only Self Support
RED HAT ENTERPRISE LINUX ACADEMIC SITE SUBSCRIPTIONS
Available Only Self Support
Access and Installation
1. Access a subscription that includes Developer Toolset
2. If using Satellite, generate a new certificate
3. Register your RHEL system
4. Attach a subscription
5. Add the channel [refer to release notes: red.ht/devToolset]
6. yum install devtoolset2
Links
• Developer Program• http://red.ht/rheldevelop
• Developer Toolset Documentation• http://red.ht/devToolset
• This talk/video:• http://bit.ly/dtstalk
Contacts
• General questions, thoughts, etc.
• [email protected]• Red Hat Developer Toolset
● Product Manager – Brian Gollaher ([email protected])
● Engineering Lead– Martha Benitez ([email protected])
Related Talks and Events
DevNation Hacknight• Today, 6pm-11pm, Room 224
• Registration required: http://devnation-hacknight.eventbrite.com/
DevNation Pub crawl
• Today, 11pm-late
“I'm Too Busy to Deal with Security”
• Bill Burke, Room 220
“Pinpoint memory cachline tearing for NUMA performance gains”
• Don Zickus & Joe Mario, Room 224