Knowledge

Dynamic linker

Source ๐Ÿ“

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

Index


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
Microsoft Windows

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

โ†‘