Knowledge (XXG)

Dynamic linker

Source ๐Ÿ“

607:
being run is linked with its own copy of the library functions being called upon. Therefore, if a library is called upon many times by different programs, the same functions in that library are duplicated in several places in the system's memory. Using shared, dynamic libraries means that, instead of linking each file to its own copy of a library at compilation time and potentially wasting memory space, only one copy of the library is ever stored in memory at a time, freeing up memory space to be used elsewhere. Additionally, in dynamic linking, a library is only loaded if it is actually being used.
489:
machine-specific call or jump instruction to one of those well-known address points. The executables on the macOS and iOS platforms often interact with the dynamic linker during the execution of the process; it is even known that an executable might interact with the dynamic linker, causing it to load more libraries and resolve more symbols, hours after it initially launches. The reason that a macOS or iOS program interacts with the dynamic linker so often is due both to Apple's
453:; consequently, it is possible to read pre-compressed (gzipped) file data on BSD and Linux systems as if the files were not compressed, essentially allowing a user to add transparent compression to the underlying filesystem, although with some caveats. The mechanism is flexible, allowing trivial adaptation of the same code to perform additional or alternate processing of data during the file read, prior to the provision of said data to the user process that has requested it. 619: 36: 577:
that activates the operating system routines that makes the library module to be linked available to the program. Library modules may reside in a "STEPLIB" or "JOBLIB" specified in control cards and only available to a specific execution of the program, in a library included in the LINKLIST in the
370:
When an executable file is loaded, the operating system kernel reads the path of the dynamic linker from it and then attempts to load and execute this other executable binary; if that attempt fails because, for example, there is no file with that path, the attempt to execute the original executable
606:
Dynamic linking is generally slower (requires more CPU cycles) than linking during compilation time, as is the case for most processes executed at runtime. However, dynamic linking is often more space-efficient (on disk and in memory at runtime). When a library is linked statically, every process
488:
The dynamic linker not only links the target executable to the shared libraries but also places machine code functions at specific address points in memory that the target executable knows about at link time. When an executable wishes to interact with the dynamic linker, it simply executes the
430:
The dynamic linker can be influenced into modifying its behavior during either the program's execution or the program's linking, and the examples of this can be seen in the run-time linker manual pages for various Unix-like systems. A typical modification of this behavior is the use of
1101: 594:. A call to a routine not part of the current segment will cause the system to find the referenced segment, in memory or on disk, and add it to the address space of the running process. Dynamic linking is the normal method of operation, and static linking (using the 504:
The dynamic linker can be coerced into modifying some of its behavior; however, unlike other Unix-like operating systems, these modifications are hints that can be (and sometimes are) ignored by the dynamic linker. Examples of this can be seen in
371:
fails. The dynamic linker then loads the initial executable image and all the dynamically-linked libraries on which it depends and starts the executable. As a result, the pathname of the dynamic linker is part of the operating system's
442:, which adjust the runtime linking process by searching for shared libraries at alternate locations and by forcibly loading and linking libraries that would otherwise not be, respectively. An example is zlibc, also known as 517:
environment variables. The former of the previously-mentioned variables adjusts the executables' search path for the shared libraries, while the latter displays the names of the libraries as they are loaded and linked.
314:
as a DLL, but with different file extensions and possibly containing only resource sections, can be called resource DLLs. Examples of such DLLs include multi-language user interface libraries with extension
561:. This variable adjusts the runtime linking process by searching for shared libraries at alternate locations and by forcibly loading and linking libraries that would otherwise not be, respectively. 552:
The dynamic linker can be influenced into modifying its behavior during either the program's execution or the program's linking. A typical modification of this behavior is the use of the
1141: 1134: 477:
load commands in the executable image. In those systems, dynamically loaded shared libraries can be identified either by the filename suffix
1127: 578:
PARMLIB (specified at system startup time), or in the "link pack area" where specific reentrant modules are loaded at system startup time.
1308: 161: 1049: 119: 57: 50: 473:
operating systems built on top of it, the path of the dynamic linker that should be used is embedded at link time into one of the
351:
systems, most of the machine code that makes up the dynamic linker is actually an external executable that the operating system
955: 384: 177: 100: 180:. The specific operating system and executable format determine how the dynamic linker functions and how it is implemented. 72: 657: 1001: 1150: 372: 1303: 1092: 624: 574: 187:, while a dynamic linker is a special part of an operating system that loads external shared libraries into a running 79: 1255: 948: 726: 388: 367:
functions. At link time, the path of the dynamic linker that should be used is embedded into the executable image.
46: 1250: 1219: 905: 522: 462: 352: 86: 1167: 976: 450: 357: 68: 1224: 1076: 423:
segment. In those systems, dynamically loaded shared libraries can be identified by the filename suffix
1008: 570: 439: 1040:. The Morgan Kaufmann Series in Software Engineering and Programming (1 ed.). San Francisco, USA: 1234: 558: 222: 217: 835: 1199: 1182: 1078: 1063: 591: 272: 188: 720: 1313: 1277: 1265: 1172: 1110: 701: 300: 165: 149: 145: 767: 1282: 1055: 1045: 363: 234: 501:, the language in which they are implemented (see their main articles for more information). 355:
loads and executes first in a process address space newly constructed as a result of calling
1260: 320: 296: 241: 192: 153: 141: 93: 1041: 877: 642: 195:
those shared libraries dynamically to the running process. This approach is also called
1214: 1187: 1031: 632: 482: 415:, the path of the dynamic linker that should be used is embedded at link time into the 284: 245: 230: 899: 1297: 1204: 1119: 853: 412: 307: 264: 1194: 647: 292: 184: 183:
Linking is often referred to as a process that is performed when the executable is
1229: 1209: 618: 498: 494: 490: 470: 311: 35: 17: 1177: 614: 173: 157: 1059: 348: 226: 133: 521:
Apple's macOS dynamic linker is an open-source project released as part of
509:'s manual page. A typical modification of this behavior is the use of the 913: 823: 800: 777: 753: 730: 637: 328: 819: 773: 652: 587: 554: 408: 400: 256: 796: 790: 474: 404: 288: 280: 276: 446:, which facilitates transparent decompression when used through the 743: 909: 813: 749: 538: 466: 396: 392: 677: 238: 1123: 1035: 926: 980: 839: 573:
is done typically using a LINK macro instruction containing a
545:, dynamically-loaded shared libraries use the filename suffix 542: 268: 169: 29: 904:: Darwin/Mac OS X dynamic linker/loader โ€“  1081: 267:). The file formats for DLLs are the same as for Windows 590:
operating system all files, including executables, are
818:: OpenBSD dynamic linker/loader โ€“  772:: FreeBSD dynamic linker/loader โ€“  725:: Solaris dynamic linker/loader โ€“  387:
for executable images and dynamic libraries, such as
343:
Unix-like systems using ELF, and Darwin-based systems
795:: NetBSD dynamic linker/loader โ€“  569:
Dynamic linking from Assembler language programs in
1243: 1158: 949:"Operating Systems Principles: Linking and Loading" 836:"ZLIBC - Transparent access to compressed files" 1102:Dynamic Linking in Linux and Windows, part one 1135: 164:"), by copying the content of libraries from 8: 525:and can be found in the Apple's open-source 1142: 1128: 1120: 323:libraries, sometimes having the extension 120:Learn how and when to remove this message 756:โ€“ Administration and Privileged Commands 291:Windows. As with EXEs, DLLs can contain 692: 669: 56:Please improve this article by adding 537:In Unix-like operating systems using 27:Part of a computer's operating system 7: 977:"Anatomy of Linux dynamic libraries" 706:Microsoft Developer Network Library 244:. These libraries usually have the 1111:Anatomy of Linux dynamic libraries 25: 481:or by their placement inside the 271:files – that is, 617: 34: 1066:from the original on 2012-12-05 1000:Sivilotti, Paul (August 2012). 956:North Carolina State University 702:"Creating a Resource-Only DLL" 383:In Unix-like systems that use 1: 1002:"Dynamic Linking and Loading" 658:Dynamic dead code elimination 571:IBM OS/360 and its successors 533:XCOFF-based Unix-like systems 465:operating system, and in the 331:files, having the extensions 58:secondary or tertiary sources 1151:Application binary interface 676:Not to be confused with the 419:section of the executable's 373:application binary interface 1093:Dynamic Linking and Loading 625:Computer programming portal 575:Supervisor Call instruction 1330: 1309:Computer security exploits 1256:Foreign function interface 255:(for libraries containing 215: 1251:Binary-code compatibility 1220:Position-independent code 229:'s implementation of the 160:when it is executed (at " 975:Jones, M. (2008-08-28). 927:"Open Source - Releases" 729:User Commands Reference 700:Microsoft Corporation. 947:Xuxian, Jiang (2009). 303:, in any combination. 45:relies excessively on 1009:Ohio State University 565:OS/360 and successors 440:environment variables 391:, 64-bit versions of 1235:Virtual method table 680:compression library. 598:) is the exception. 559:environment variable 515:DYLD_PRINT_LIBRARIES 223:Dynamic-link library 218:Dynamic-link library 1200:Memory segmentation 1037:Linkers and Loaders 511:DYLD_FRAMEWORK_PATH 273:Portable Executable 1304:Computer libraries 1173:Calling convention 166:persistent storage 140:is the part of an 1291: 1290: 1283:Year 2038 problem 912:General Commands 822:General Commands 799:General Commands 776:General Commands 485:for a framework. 427:(shared object). 379:Systems using ELF 242:operating systems 235:Microsoft Windows 212:Microsoft Windows 130: 129: 122: 104: 16:(Redirected from 1321: 1261:Language binding 1144: 1137: 1130: 1121: 1074: 1072: 1071: 1019: 1018: 1016: 1015: 1006: 997: 991: 990: 988: 987: 972: 966: 965: 963: 962: 953: 944: 938: 937: 935: 934: 922: 916: 903: 902: 895: 889: 888: 886: 885: 874: 868: 867: 865: 864: 850: 844: 843: 838:. Archived from 832: 826: 817: 816: 809: 803: 794: 793: 786: 780: 771: 770: 763: 757: 747: 746: 739: 733: 724: 723: 716: 710: 709: 697: 681: 674: 627: 622: 621: 557: 548: 528: 516: 512: 508: 480: 449: 445: 438: 434: 426: 422: 418: 366: 360: 338: 334: 326: 318: 262: 254: 250: 154:shared libraries 142:operating system 125: 118: 114: 111: 105: 103: 69:"Dynamic linker" 62: 38: 30: 21: 1329: 1328: 1324: 1323: 1322: 1320: 1319: 1318: 1294: 1293: 1292: 1287: 1239: 1160: 1154: 1148: 1089: 1069: 1067: 1052: 1042:Morgan Kaufmann 1032:Levine, John R. 1030: 1027: 1025:Further reading 1022: 1013: 1011: 1004: 999: 998: 994: 985: 983: 974: 973: 969: 960: 958: 951: 946: 945: 941: 932: 930: 924: 923: 919: 898: 897: 896: 892: 883: 881: 876: 875: 871: 862: 860: 854:"uncompress.so" 852: 851: 847: 834: 833: 829: 812: 811: 810: 806: 789: 788: 787: 783: 766: 765: 764: 760: 742: 741: 740: 736: 719: 718: 717: 713: 699: 698: 694: 690: 685: 684: 675: 671: 666: 643:Dynamic loading 623: 616: 613: 604: 584: 567: 553: 546: 535: 526: 514: 510: 506: 478: 459: 447: 443: 436: 433:LD_LIBRARY_PATH 432: 424: 420: 416: 381: 362: 356: 345: 336: 332: 324: 316: 260: 252: 248: 233:concept in the 220: 214: 209: 207:Implementations 197:dynamic linking 176:and relocating 126: 115: 109: 106: 63: 61: 55: 51:primary sources 39: 28: 23: 22: 18:Dynamic library 15: 12: 11: 5: 1327: 1325: 1317: 1316: 1311: 1306: 1296: 1295: 1289: 1288: 1286: 1285: 1280: 1275: 1274: 1273: 1263: 1258: 1253: 1247: 1245: 1244:Related topics 1241: 1240: 1238: 1237: 1232: 1227: 1222: 1217: 1215:Opaque pointer 1212: 1207: 1202: 1197: 1192: 1191: 1190: 1180: 1175: 1170: 1164: 1162: 1156: 1155: 1149: 1147: 1146: 1139: 1132: 1124: 1118: 1117: 1108: 1099: 1088: 1087:External links 1085: 1084: 1083: 1050: 1026: 1023: 1021: 1020: 992: 967: 939: 917: 890: 869: 845: 842:on 2000-06-04. 827: 804: 781: 758: 744:ld-linux.so(8) 734: 711: 691: 689: 686: 683: 682: 668: 667: 665: 662: 661: 660: 655: 650: 645: 640: 635: 633:Direct binding 629: 628: 612: 609: 603: 600: 583: 580: 566: 563: 534: 531: 458: 455: 380: 377: 344: 341: 310:with the same 285:New Executable 265:system drivers 259:controls), or 246:file extension 231:shared library 216:Main article: 213: 210: 208: 205: 138:dynamic linker 128: 127: 42: 40: 33: 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 1326: 1315: 1312: 1310: 1307: 1305: 1302: 1301: 1299: 1284: 1281: 1279: 1276: 1272: 1269: 1268: 1267: 1264: 1262: 1259: 1257: 1254: 1252: 1249: 1248: 1246: 1242: 1236: 1233: 1231: 1228: 1226: 1223: 1221: 1218: 1216: 1213: 1211: 1208: 1206: 1205:Name mangling 1203: 1201: 1198: 1196: 1193: 1189: 1186: 1185: 1184: 1181: 1179: 1176: 1174: 1171: 1169: 1166: 1165: 1163: 1157: 1152: 1145: 1140: 1138: 1133: 1131: 1126: 1125: 1122: 1116: 1112: 1109: 1107: 1103: 1100: 1098: 1094: 1091: 1090: 1086: 1082: 1079: 1077: 1065: 1061: 1057: 1053: 1051:1-55860-496-0 1047: 1043: 1039: 1038: 1033: 1029: 1028: 1024: 1010: 1003: 996: 993: 982: 978: 971: 968: 957: 950: 943: 940: 928: 921: 918: 915: 911: 907: 901: 894: 891: 880:. delorie.com 879: 873: 870: 859: 855: 849: 846: 841: 837: 831: 828: 825: 821: 815: 808: 805: 802: 798: 792: 785: 782: 779: 775: 769: 762: 759: 755: 752:Programmer's 751: 748: โ€“  745: 738: 735: 732: 728: 722: 715: 712: 707: 703: 696: 693: 687: 679: 673: 670: 663: 659: 656: 654: 651: 649: 646: 644: 641: 639: 636: 634: 631: 630: 626: 620: 615: 610: 608: 601: 599: 597: 593: 589: 581: 579: 576: 572: 564: 562: 560: 556: 550: 544: 540: 532: 530: 524: 519: 502: 500: 496: 492: 486: 484: 476: 472: 468: 464: 461:In the Apple 457:macOS and iOS 456: 454: 452: 444:uncompress.so 441: 428: 414: 413:DragonFly BSD 410: 406: 402: 398: 394: 390: 386: 378: 376: 374: 368: 365: 359: 354: 350: 342: 340: 330: 322: 313: 309: 304: 302: 298: 294: 290: 286: 283:Windows, and 282: 278: 274: 270: 266: 258: 247: 243: 240: 236: 232: 228: 225:, or DLL, is 224: 219: 211: 206: 204: 202: 198: 194: 190: 186: 181: 179: 175: 171: 167: 163: 159: 156:needed by an 155: 151: 147: 143: 139: 135: 124: 121: 113: 102: 99: 95: 92: 88: 85: 81: 78: 74: 71: โ€“  70: 66: 65:Find sources: 59: 53: 52: 48: 43:This article 41: 37: 32: 31: 19: 1270: 1195:Machine code 1114: 1106:Symantec.com 1105: 1096: 1068:. Retrieved 1036: 1012:. Retrieved 995: 984:. Retrieved 970: 959:. Retrieved 942: 931:. Retrieved 920: 893: 882:. Retrieved 878:"zlibc.conf" 872: 861:. Retrieved 857: 848: 840:the original 830: 807: 791:ld.elf_so(1) 784: 761: 737: 727:Solaris 11.4 714: 705: 695: 672: 648:Late binding 605: 595: 585: 568: 551: 536: 520: 503: 487: 460: 429: 382: 369: 346: 305: 263:(for legacy 221: 201:late linking 200: 196: 182: 137: 131: 116: 107: 97: 90: 83: 76: 64: 44: 1230:System call 1210:Object code 1161:conventions 929:. apple.com 925:Apple Inc. 858:delorie.com 499:Objective-C 495:Cocoa Touch 364:posix_spawn 312:file format 174:jump tables 1298:Categories 1225:Relocation 1178:Call stack 1070:2020-01-12 1014:2020-09-24 986:2020-09-24 961:2020-09-24 933:2014-07-04 884:2014-07-04 863:2014-07-04 721:ld.so.1(1) 688:References 602:Efficiency 541:, such as 448:LD_PRELOAD 437:LD_PRELOAD 172:, filling 158:executable 110:March 2011 80:newspapers 47:references 1314:Compilers 1168:Alignment 1034:(2000) . 529:project. 497:APIs and 421:PT_INTERP 349:Unix-like 301:resources 287:(NE) for 275:(PE) for 227:Microsoft 191:and then 134:computing 1097:IECC.com 1080:Errata: 1064:Archived 1060:42413382 814:ld.so(1) 638:DLL Hell 611:See also 592:segments 347:In most 185:compiled 178:pointers 162:run time 1271:dynamic 1183:Library 1115:IBM.com 900:dyld(1) 820:OpenBSD 774:FreeBSD 768:rtld(1) 653:prelink 588:Multics 586:In the 582:Multics 555:LIBPATH 417:.interp 409:OpenBSD 401:FreeBSD 389:Solaris 257:ActiveX 189:process 94:scholar 1278:Loader 1266:Linker 1188:static 1159:Parts, 1075:Code: 1058:  1048:  914:Manual 906:Darwin 824:Manual 801:Manual 797:NetBSD 778:Manual 754:Manual 731:Manual 596:binder 523:Darwin 483:bundle 479:.dylib 475:Mach-O 463:Darwin 411:, and 405:NetBSD 353:kernel 327:, and 299:, and 289:16-bit 281:64-bit 277:32-bit 96:  89:  82:  75:  67:  1153:(ABI) 1005:(PDF) 952:(PDF) 910:macOS 750:Linux 664:Notes 539:XCOFF 491:Cocoa 467:macOS 397:Linux 393:HP-UX 308:files 306:Data 193:binds 150:links 146:loads 144:that 101:JSTOR 87:books 1056:OCLC 1046:ISBN 908:and 678:zlib 527:dyld 513:and 507:dyld 493:and 469:and 451:hack 435:and 358:exec 335:and 329:font 321:icon 297:data 293:code 279:and 239:OS/2 237:and 152:the 148:and 136:, a 73:news 981:IBM 543:AIX 471:iOS 425:.so 385:ELF 361:or 337:FOT 333:FON 325:ICL 317:MUI 269:EXE 261:DRV 253:OCX 249:DLL 199:or 170:RAM 168:to 132:In 49:to 1300:: 1113:, 1104:, 1095:, 1062:. 1054:. 1044:. 1007:. 979:. 954:. 856:. 704:. 549:. 547:.a 407:, 403:, 399:, 395:, 375:. 339:. 319:, 295:, 251:, 203:. 60:. 1143:e 1136:t 1129:v 1073:. 1017:. 989:. 964:. 936:. 887:. 866:. 708:. 123:) 117:( 112:) 108:( 98:ยท 91:ยท 84:ยท 77:ยท 54:. 20:)

Index

Dynamic library

references
primary sources
secondary or tertiary sources
"Dynamic linker"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
computing
operating system
loads
links
shared libraries
executable
run time
persistent storage
RAM
jump tables
pointers
compiled
process
binds
Dynamic-link library
Dynamic-link library
Microsoft
shared library

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

โ†‘