SlideShare a Scribd company logo
1 of 7
GCC on Linux
The beast and it's taming
Mark Veltzer
mark.veltzer@gmail.com
Getting data from stdin
● Input file would be -
● You have to specify the input language using
the -x flag
● Possible values include: c,c++,objective-
c,objective-c++,assembler,assembler-with-
cpp,ada,f77,f95,java and many more
● Example: gcc -x c -
● Output file either specified with -o or would be
the standard (a.out).
Getting help
● man gcc – good for quick reference to flags
● Info gcc – more in depth (warning: entire
book!)
● gcc – help – only most common flags but good
for 99% of the cases (two minuses!)
● gcc –target-help – shows options that have to
do with target code generation
● gcc –help=warnings – shows all warning flags
What version of gcc are you
running?
● On the command line you can use the following
● gcc –version – first line shows the compiler
version
● gcc -v – more info (including threading model,
configuration and
● Or you can use your package management
utilities to determine the version of the gcc
package
● In your source code (TODO)
What version of gcc are you
running?
● In your source code you can use the following
macros
● __VERSION__ - has the compiler version you
are using as a string
● __GXX_ABI_VERSION – has the C++ ABI
version that the current compiler implements
● linux, __linux, __linux__, unix, __unix,
__unix__, __gnu_linux__ are defined symbols
What version of gcc are you
running? (cont)
● __GNUC__ - is your compilers major version
number
● __GNUC_MINOR__ - has the minor version of
your compiler
● __GNUC_PATCHLEVEL__ - has the patch
level of your compiler
The preprocessor
● cpp on the command line
● echo | g[cc|++] -E -dM - - will dump your
preprocessors defined symbols for C

More Related Content

Similar to Gcc

Compiler design notes phases of compiler
Compiler design notes phases of compilerCompiler design notes phases of compiler
Compiler design notes phases of compiler
ovidlivi91
 
Software Security - Static Analysis Tools
Software Security - Static Analysis ToolsSoftware Security - Static Analysis Tools
Software Security - Static Analysis Tools
Emanuela Boroș
 

Similar to Gcc (20)

GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005
 
GCC
GCCGCC
GCC
 
lab1-ppt.pdf
lab1-ppt.pdflab1-ppt.pdf
lab1-ppt.pdf
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
 
10 reasons to be excited about go
10 reasons to be excited about go10 reasons to be excited about go
10 reasons to be excited about go
 
Process (OS),GNU,Introduction to Linux oS
Process (OS),GNU,Introduction to Linux oSProcess (OS),GNU,Introduction to Linux oS
Process (OS),GNU,Introduction to Linux oS
 
Compiler design notes phases of compiler
Compiler design notes phases of compilerCompiler design notes phases of compiler
Compiler design notes phases of compiler
 
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
 
Autotools pratical training
Autotools pratical trainingAutotools pratical training
Autotools pratical training
 
G++ & GCC
G++ & GCCG++ & GCC
G++ & GCC
 
cs262_intro_slides.pptx
cs262_intro_slides.pptxcs262_intro_slides.pptx
cs262_intro_slides.pptx
 
Gnu debugger
Gnu debuggerGnu debugger
Gnu debugger
 
GNU Debugger
GNU DebuggerGNU Debugger
GNU Debugger
 
Software Security - Static Analysis Tools
Software Security - Static Analysis ToolsSoftware Security - Static Analysis Tools
Software Security - Static Analysis Tools
 
C programming first_session
C programming first_sessionC programming first_session
C programming first_session
 
C programming first_session
C programming first_sessionC programming first_session
C programming first_session
 
GCC compiler
GCC compilerGCC compiler
GCC compiler
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
 

More from Mark Veltzer (11)

Linux io
Linux ioLinux io
Linux io
 
Linux logging
Linux loggingLinux logging
Linux logging
 
Linux monitoring
Linux monitoringLinux monitoring
Linux monitoring
 
Linux multiplexing
Linux multiplexingLinux multiplexing
Linux multiplexing
 
Linux tmpfs
Linux tmpfsLinux tmpfs
Linux tmpfs
 
Multicore
MulticoreMulticore
Multicore
 
Pthreads linux
Pthreads linuxPthreads linux
Pthreads linux
 
Realtime
RealtimeRealtime
Realtime
 
Streams
StreamsStreams
Streams
 
Volatile
VolatileVolatile
Volatile
 
Effective cplusplus
Effective cplusplusEffective cplusplus
Effective cplusplus
 

Recently uploaded

Recently uploaded (20)

AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 

Gcc

  • 1. GCC on Linux The beast and it's taming Mark Veltzer mark.veltzer@gmail.com
  • 2. Getting data from stdin ● Input file would be - ● You have to specify the input language using the -x flag ● Possible values include: c,c++,objective- c,objective-c++,assembler,assembler-with- cpp,ada,f77,f95,java and many more ● Example: gcc -x c - ● Output file either specified with -o or would be the standard (a.out).
  • 3. Getting help ● man gcc – good for quick reference to flags ● Info gcc – more in depth (warning: entire book!) ● gcc – help – only most common flags but good for 99% of the cases (two minuses!) ● gcc –target-help – shows options that have to do with target code generation ● gcc –help=warnings – shows all warning flags
  • 4. What version of gcc are you running? ● On the command line you can use the following ● gcc –version – first line shows the compiler version ● gcc -v – more info (including threading model, configuration and ● Or you can use your package management utilities to determine the version of the gcc package ● In your source code (TODO)
  • 5. What version of gcc are you running? ● In your source code you can use the following macros ● __VERSION__ - has the compiler version you are using as a string ● __GXX_ABI_VERSION – has the C++ ABI version that the current compiler implements ● linux, __linux, __linux__, unix, __unix, __unix__, __gnu_linux__ are defined symbols
  • 6. What version of gcc are you running? (cont) ● __GNUC__ - is your compilers major version number ● __GNUC_MINOR__ - has the minor version of your compiler ● __GNUC_PATCHLEVEL__ - has the patch level of your compiler
  • 7. The preprocessor ● cpp on the command line ● echo | g[cc|++] -E -dM - - will dump your preprocessors defined symbols for C