SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
The Linker
  Common Issues
General wisdom
Read ld.so.1(1)
Verify your
assumptions
What does the linker do?



Combine an executable and shared
libraries to a runnable entity
How does it work?
                          (a bit simplified...)


This is runtime linking!
Look for wanted libs in NEEDED in the object
[1]     NEEDED          libcurses.so.1
[2]     NEEDED          libintl.so.8
[3]     NEEDED          libiconv.so.2



Search them in system dirs
  Default Library Path (ELF):   /lib:/usr/lib (system default)
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure (system default)


and RUNPATH
[10]    RUNPATH         /opt/csw/lib/$ISALIST:/opt/csw/lib
Getting the runpath in
      the binary
 Read ld(1)
 Always done during compile-time linking
 Option „-R <path>“
 LD_OPTIONS is processed before -R
   This can break testsuites
-R or LD_OPTIONS ?
-R in LDFLAGS
  Plays nice with applications
     If they honour LDFLAGS
  Multiple shell invocations may destroy
  $ISALIST
LD_OPTIONS
  Works always
  May confuse build of test apps as they link
  against installed libs instead of the newly
  build
$ISALIST
Dynamically expanded by ld.so.1, e.g.
sparcv9+vis2
sparcv9+vis
sparcv9
sparcv8plus+vis2
sparcv8plus+vis
sparcv8plus
sparcv8
sparcv8-fsmuld
sparcv7
sparc


See also isalist(1)
Debugging
        Static info from the binary

dump -Lv <binary>
dam@login [login]:/home/dam > dump -Lv /opt/csw/bin/bash

/opt/csw/bin/bash:

  **** DYNAMIC SECTION INFORMATION ****
.dynamic:
[INDEX] Tag         Value
[1]     NEEDED          libcurses.so.1
[2]     NEEDED          libintl.so.8
[3]     NEEDED          libiconv.so.2
[4]     NEEDED          libsocket.so.1
[5]     NEEDED          libnsl.so.1
[6]     NEEDED          libdl.so.1
[7]     NEEDED          libc.so.1
[8]     INIT            0xce204
[9]     FINI            0xce214
[10]    RUNPATH         /opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib
[11]    RPATH           /opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib
[12]    HASH            0x100e8
[13]    STRTAB          0x1c994
...




lari <binary>
Debugging
   Info from the running process

pldd
dam@login [login]:/home/dam > pldd $$
3838:   /opt/csw/bin/zsh
/opt/csw/lib/libgdbm.so.3.0.0
/opt/csw/lib/libpcre.so.0.0.1
/opt/csw/lib/libiconv.so.2.5.1
/lib/libsocket.so.1
/lib/libdl.so.1
/opt/csw/lib/libncursesw.so.5.9
/lib/libm.so.1
/lib/libc.so.1
/lib/libnsl.so.1
/platform/sun4v/lib/libc_psr.so.1
/opt/csw/lib/zsh/4.3.10/zsh/zle.so
AUXV linkage

Link option
         -f <filtee>
E.g. ld   -h libcurl.so.4 -f libcurl-feature.so.4 ...


How does it look in the binary?
[10]      SONAME         libcurl.so.4
[11]      AUXILIARY      libcurl-feature.so.4

Weitere ähnliche Inhalte

Was ist angesagt?

MongoDB Munich 2012: MongoDB for official documents in Bavaria
MongoDB Munich 2012: MongoDB for official documents in BavariaMongoDB Munich 2012: MongoDB for official documents in Bavaria
MongoDB Munich 2012: MongoDB for official documents in BavariaMongoDB
 
Talkaboutlithium
TalkaboutlithiumTalkaboutlithium
Talkaboutlithiumnoppoman722
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptKenny (netman)
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash scriptSimon Su
 
Meet up symfony 16 juin 2017 - Les PSR
Meet up symfony 16 juin 2017 -  Les PSRMeet up symfony 16 juin 2017 -  Les PSR
Meet up symfony 16 juin 2017 - Les PSRJulien Vinber
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2Dvir Volk
 
Git/Github/Bitbucket@TalkIt. Humber college.
Git/Github/Bitbucket@TalkIt. Humber college.Git/Github/Bitbucket@TalkIt. Humber college.
Git/Github/Bitbucket@TalkIt. Humber college.Andrew Romanenco
 
Sample file processing
Sample file processingSample file processing
Sample file processingIssay Meii
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertorToshiaki Baba
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integralfukamachi
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queueBrandon Lamb
 
Play with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniquePlay with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniqueAngel Boy
 

Was ist angesagt? (20)

MongoDB Munich 2012: MongoDB for official documents in Bavaria
MongoDB Munich 2012: MongoDB for official documents in BavariaMongoDB Munich 2012: MongoDB for official documents in Bavaria
MongoDB Munich 2012: MongoDB for official documents in Bavaria
 
Hypertable Nosql
Hypertable NosqlHypertable Nosql
Hypertable Nosql
 
Talkaboutlithium
TalkaboutlithiumTalkaboutlithium
Talkaboutlithium
 
Ruby meetup ROM
Ruby meetup ROMRuby meetup ROM
Ruby meetup ROM
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Shell script-sec
Shell script-secShell script-sec
Shell script-sec
 
Quick start bash script
Quick start   bash scriptQuick start   bash script
Quick start bash script
 
Android APP-toggle case
Android APP-toggle caseAndroid APP-toggle case
Android APP-toggle case
 
Elephants and Raft
Elephants and RaftElephants and Raft
Elephants and Raft
 
working with files
working with filesworking with files
working with files
 
Meet up symfony 16 juin 2017 - Les PSR
Meet up symfony 16 juin 2017 -  Les PSRMeet up symfony 16 juin 2017 -  Les PSR
Meet up symfony 16 juin 2017 - Les PSR
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Git/Github/Bitbucket@TalkIt. Humber college.
Git/Github/Bitbucket@TalkIt. Humber college.Git/Github/Bitbucket@TalkIt. Humber college.
Git/Github/Bitbucket@TalkIt. Humber college.
 
Using Logstash, elasticsearch & kibana
Using Logstash, elasticsearch & kibanaUsing Logstash, elasticsearch & kibana
Using Logstash, elasticsearch & kibana
 
Sample file processing
Sample file processingSample file processing
Sample file processing
 
agri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertoragri inventory - nouka data collector / yaoya data convertor
agri inventory - nouka data collector / yaoya data convertor
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integral
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queue
 
Play with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniquePlay with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit Technique
 
Createclone
CreatecloneCreateclone
Createclone
 

Andere mochten auch

Awesome text animations
Awesome text animationsAwesome text animations
Awesome text animationsd_boydst1
 
5MAllicivilization
5MAllicivilization5MAllicivilization
5MAllicivilizationgsbSS
 
Content based instruction
Content   based   instructionContent   based   instruction
Content based instructionAli Miri
 
Imkt120 padilla juan_unit1_ip
Imkt120 padilla juan_unit1_ipImkt120 padilla juan_unit1_ip
Imkt120 padilla juan_unit1_ipJuan Padilla
 
Taking good Photographs for you Media Coursework
Taking good Photographs for you Media CourseworkTaking good Photographs for you Media Coursework
Taking good Photographs for you Media Courseworkcarolinebirksatwork
 
5M Peyton Civilization
5M Peyton Civilization5M Peyton Civilization
5M Peyton CivilizationgsbSS
 
How do you enjoy sex with your back pains?
How do you enjoy sex with your back pains?How do you enjoy sex with your back pains?
How do you enjoy sex with your back pains?Louisehaker
 
Superant obstacles
Superant obstaclesSuperant obstacles
Superant obstaclescarmeo
 
Works cited page
Works cited pageWorks cited page
Works cited pageteaya
 
105 Tinamen Mountains
105 Tinamen Mountains105 Tinamen Mountains
105 Tinamen Mountainsiamthelegend
 
Module for principles and application of precision agriculture
Module for principles and application of precision agricultureModule for principles and application of precision agriculture
Module for principles and application of precision agricultureJAWI Herbs Centre
 
5S Alicia civilization
5S Alicia civilization5S Alicia civilization
5S Alicia civilizationgsbSS
 
5l Sophia Civilization
5l Sophia Civilization5l Sophia Civilization
5l Sophia CivilizationgsbSS
 
Why Marketing Plans are Important to growth
Why Marketing Plans are Important to growthWhy Marketing Plans are Important to growth
Why Marketing Plans are Important to growthCultivation LLC
 
Is 201 presentation_2_moore's_law[1]
Is 201 presentation_2_moore's_law[1]Is 201 presentation_2_moore's_law[1]
Is 201 presentation_2_moore's_law[1]skroh
 
Innovation and Risk - July 2014
Innovation and Risk - July 2014Innovation and Risk - July 2014
Innovation and Risk - July 2014Paul Iddon
 

Andere mochten auch (18)

Teamwork
TeamworkTeamwork
Teamwork
 
Awesome text animations
Awesome text animationsAwesome text animations
Awesome text animations
 
5MAllicivilization
5MAllicivilization5MAllicivilization
5MAllicivilization
 
Content based instruction
Content   based   instructionContent   based   instruction
Content based instruction
 
Imkt120 padilla juan_unit1_ip
Imkt120 padilla juan_unit1_ipImkt120 padilla juan_unit1_ip
Imkt120 padilla juan_unit1_ip
 
Taking good Photographs for you Media Coursework
Taking good Photographs for you Media CourseworkTaking good Photographs for you Media Coursework
Taking good Photographs for you Media Coursework
 
5M Peyton Civilization
5M Peyton Civilization5M Peyton Civilization
5M Peyton Civilization
 
How do you enjoy sex with your back pains?
How do you enjoy sex with your back pains?How do you enjoy sex with your back pains?
How do you enjoy sex with your back pains?
 
Superant obstacles
Superant obstaclesSuperant obstacles
Superant obstacles
 
Works cited page
Works cited pageWorks cited page
Works cited page
 
105 Tinamen Mountains
105 Tinamen Mountains105 Tinamen Mountains
105 Tinamen Mountains
 
Module for principles and application of precision agriculture
Module for principles and application of precision agricultureModule for principles and application of precision agriculture
Module for principles and application of precision agriculture
 
5S Alicia civilization
5S Alicia civilization5S Alicia civilization
5S Alicia civilization
 
5l Sophia Civilization
5l Sophia Civilization5l Sophia Civilization
5l Sophia Civilization
 
Why Marketing Plans are Important to growth
Why Marketing Plans are Important to growthWhy Marketing Plans are Important to growth
Why Marketing Plans are Important to growth
 
Is 201 presentation_2_moore's_law[1]
Is 201 presentation_2_moore's_law[1]Is 201 presentation_2_moore's_law[1]
Is 201 presentation_2_moore's_law[1]
 
Innovation and Risk - July 2014
Innovation and Risk - July 2014Innovation and Risk - July 2014
Innovation and Risk - July 2014
 
Huldy orjuela
Huldy orjuelaHuldy orjuela
Huldy orjuela
 

Ähnlich wie Linker Wisdom

LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723Iftach Ian Amit
 
LinuxCon Japan 2010 suzaki
LinuxCon Japan 2010 suzakiLinuxCon Japan 2010 suzaki
LinuxCon Japan 2010 suzakiKuniyasu Suzaki
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Vincent Batts
 
The true story_of_hello_world
The true story_of_hello_worldThe true story_of_hello_world
The true story_of_hello_worldfantasy zheng
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentMohammed Farrag
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
Binary Packaging for HPC with Spack
Binary Packaging for HPC with SpackBinary Packaging for HPC with Spack
Binary Packaging for HPC with Spackinside-BigData.com
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 
Nix: What even is it though?
Nix: What even is it though?Nix: What even is it though?
Nix: What even is it though?Burke Libbey
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdockerJaehwa Park
 
101 2.3 manage shared libraries
101 2.3 manage shared libraries101 2.3 manage shared libraries
101 2.3 manage shared librariesAcácio Oliveira
 
2.3 manage shared libraries
2.3 manage shared libraries2.3 manage shared libraries
2.3 manage shared librariesAcácio Oliveira
 
Oracle to MySQL DatabaseLink
Oracle to MySQL DatabaseLinkOracle to MySQL DatabaseLink
Oracle to MySQL DatabaseLinkOsama Mustafa
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Tetsuyuki Kobayashi
 
Getting started with libfabric
Getting started with libfabricGetting started with libfabric
Getting started with libfabricJianxin Xiong
 
CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practicesDaniel Pfeifer
 
LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1Hajime Tazaki
 
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB DevroomMore on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB DevroomValeriy Kravchuk
 
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Jennifer Shelton
 

Ähnlich wie Linker Wisdom (20)

LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723LD_PRELOAD Exploitation - DC9723
LD_PRELOAD Exploitation - DC9723
 
LinuxCon Japan 2010 suzaki
LinuxCon Japan 2010 suzakiLinuxCon Japan 2010 suzaki
LinuxCon Japan 2010 suzaki
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]
 
The true story_of_hello_world
The true story_of_hello_worldThe true story_of_hello_world
The true story_of_hello_world
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Binary Packaging for HPC with Spack
Binary Packaging for HPC with SpackBinary Packaging for HPC with Spack
Binary Packaging for HPC with Spack
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
Nix: What even is it though?
Nix: What even is it though?Nix: What even is it though?
Nix: What even is it though?
 
Docker 활용법: dumpdocker
Docker 활용법: dumpdockerDocker 활용법: dumpdocker
Docker 활용법: dumpdocker
 
101 2.3 manage shared libraries
101 2.3 manage shared libraries101 2.3 manage shared libraries
101 2.3 manage shared libraries
 
2.3 manage shared libraries
2.3 manage shared libraries2.3 manage shared libraries
2.3 manage shared libraries
 
Oracle to MySQL DatabaseLink
Oracle to MySQL DatabaseLinkOracle to MySQL DatabaseLink
Oracle to MySQL DatabaseLink
 
Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'Android is NOT just 'Java on Linux'
Android is NOT just 'Java on Linux'
 
Getting started with libfabric
Getting started with libfabricGetting started with libfabric
Getting started with libfabric
 
CMake - Introduction and best practices
CMake - Introduction and best practicesCMake - Introduction and best practices
CMake - Introduction and best practices
 
LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1LibOS as a regression test framework for Linux networking #netdev1.1
LibOS as a regression test framework for Linux networking #netdev1.1
 
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB DevroomMore on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
More on bpftrace for MariaDB DBAs and Developers - FOSDEM 2022 MariaDB Devroom
 
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
Lecture1: NGS Analysis on Beocat and an introduction to Perl programming for ...
 
Php logging
Php loggingPhp logging
Php logging
 

Kürzlich hochgeladen

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Linker Wisdom

  • 1. The Linker Common Issues
  • 3. What does the linker do? Combine an executable and shared libraries to a runnable entity
  • 4. How does it work? (a bit simplified...) This is runtime linking! Look for wanted libs in NEEDED in the object [1] NEEDED libcurses.so.1 [2] NEEDED libintl.so.8 [3] NEEDED libiconv.so.2 Search them in system dirs Default Library Path (ELF): /lib:/usr/lib (system default) Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default) and RUNPATH [10] RUNPATH /opt/csw/lib/$ISALIST:/opt/csw/lib
  • 5. Getting the runpath in the binary Read ld(1) Always done during compile-time linking Option „-R <path>“ LD_OPTIONS is processed before -R This can break testsuites
  • 6. -R or LD_OPTIONS ? -R in LDFLAGS Plays nice with applications If they honour LDFLAGS Multiple shell invocations may destroy $ISALIST LD_OPTIONS Works always May confuse build of test apps as they link against installed libs instead of the newly build
  • 7. $ISALIST Dynamically expanded by ld.so.1, e.g. sparcv9+vis2 sparcv9+vis sparcv9 sparcv8plus+vis2 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc See also isalist(1)
  • 8. Debugging Static info from the binary dump -Lv <binary> dam@login [login]:/home/dam > dump -Lv /opt/csw/bin/bash /opt/csw/bin/bash: **** DYNAMIC SECTION INFORMATION **** .dynamic: [INDEX] Tag Value [1] NEEDED libcurses.so.1 [2] NEEDED libintl.so.8 [3] NEEDED libiconv.so.2 [4] NEEDED libsocket.so.1 [5] NEEDED libnsl.so.1 [6] NEEDED libdl.so.1 [7] NEEDED libc.so.1 [8] INIT 0xce204 [9] FINI 0xce214 [10] RUNPATH /opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib [11] RPATH /opt/csw/lib/$ISALIST:/opt/csw/lib:/opt/csw/lib:/opt/csw/lib [12] HASH 0x100e8 [13] STRTAB 0x1c994 ... lari <binary>
  • 9. Debugging Info from the running process pldd dam@login [login]:/home/dam > pldd $$ 3838: /opt/csw/bin/zsh /opt/csw/lib/libgdbm.so.3.0.0 /opt/csw/lib/libpcre.so.0.0.1 /opt/csw/lib/libiconv.so.2.5.1 /lib/libsocket.so.1 /lib/libdl.so.1 /opt/csw/lib/libncursesw.so.5.9 /lib/libm.so.1 /lib/libc.so.1 /lib/libnsl.so.1 /platform/sun4v/lib/libc_psr.so.1 /opt/csw/lib/zsh/4.3.10/zsh/zle.so
  • 10. AUXV linkage Link option -f <filtee> E.g. ld -h libcurl.so.4 -f libcurl-feature.so.4 ... How does it look in the binary? [10] SONAME libcurl.so.4 [11] AUXILIARY libcurl-feature.so.4