{"id":21690329,"url":"https://github.com/vic-lsh/os-two-pass-linker","last_synced_at":"2025-03-20T12:54:36.234Z","repository":{"id":129316084,"uuid":"168876564","full_name":"vic-lsh/os-two-pass-linker","owner":"vic-lsh","description":"Operating Systems Lab: two-pass linker","archived":false,"fork":false,"pushed_at":"2019-02-12T15:56:27.000Z","size":767,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-25T13:07:35.412Z","etag":null,"topics":["linker","linking"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vic-lsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-02-02T20:49:58.000Z","updated_at":"2019-05-13T01:12:21.000Z","dependencies_parsed_at":"2023-04-19T03:47:40.986Z","dependency_job_id":null,"html_url":"https://github.com/vic-lsh/os-two-pass-linker","commit_stats":null,"previous_names":["vicshli/os-two-pass-linker","vic-lsh/os-two-pass-linker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic-lsh%2Fos-two-pass-linker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic-lsh%2Fos-two-pass-linker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic-lsh%2Fos-two-pass-linker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic-lsh%2Fos-two-pass-linker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vic-lsh","download_url":"https://codeload.github.com/vic-lsh/os-two-pass-linker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244618425,"owners_count":20482315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linker","linking"],"created_at":"2024-11-25T17:30:02.681Z","updated_at":"2025-03-20T12:54:36.192Z","avatar_url":"https://github.com/vic-lsh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Two-Pass Linker\n\n## About the Project\n\nTo see how a linker works lets consider the following example, which is the first dataset from lab #1. The description in lab1 is more detailed.\n\nThe target machine is word addressable and each word consists of 4 decimal digits. The first (leftmost) digit is the opcode and the remaining three digits form an address.\n\nEach object module contains three parts, a definition list, a use list, and the program text itself.\n\nThe definition list consists of a count N followed by N definitions. Each definition is a pair (sym, loc) signifying that sym is defined at relative address loc.\n\nThe use list consists of a count N followed by N uses. Each use is again a pair (sym, loc), but this time signifying that sym is used in the linked list started at loc. The address in loc points to the next use of sym. An address of 777 is the sentinel ending the list. \n\nThe program text consists of a count N followed by N pairs (type, word), where word is a 4-digit instruction as described above and type is a single character indicating if the address in the word is Immediate, Absolute, Relative, or External.\n\nThe actions taken by the linker depend on the type of the address, as we now illustrate. Consider the first input set from the lab.\n```\n4\n1 xy 2\n2 xy 4 z 2\n5 R 1004  I 5678  E 2777  R 8002  E 7777\n0\n1 z 3\n6 R 8001  E 1777  E 1001  E 3002  R 1002  A 1010\n0\n1 z 1\n2 R 5001  E 4777\n1 z 2\n1 xy 2\n3 A 8000  E 1777  E 2001\n```\n                     \nThe first pass simply finds the base address of each module and produces the symbol table giving the values for xy and z (2 and 15 respectively). The second pass does the real work using the symbol table and base addresses produced in pass one.\n\nThe resulting output (shown below) is more detailed than I expect you to produce. The detail is there to help me explain what the linker is doing. All I would expect from you is the symbol table and the rightmost column of the memory map.\n\n```\nSymbol Table\nxy=2\nz=15\nMemory Map\n+0\n0:       R 1004      1004+0 = 1004\n1:       I 5678               5678\n2: xy:   E 2777 -\u003ez           2015\n3:       R 8002      8002+0 = 8002\n4:       E 7777 -\u003exy          7002\n+5\n0        R 8001      8001+5 = 8006\n1        E 1777 -\u003ez           1015\n2        E 1001 -\u003ez           1015\n3        E 3002 -\u003ez           3015\n4        R 1002      1002+5 = 1007\n5        A 1010               1010\n+11\n0        R 5001      5001+11= 5012\n1        E 4777 -\u003ez           4015\n+13\n0        A 8000               8000\n1        E 1777 -\u003exy          1002\n2 z:     E 2001 -\u003exy          2002\n```\n                     \nNote: It is faster (less I/O) to do a one pass approach, but is harder since you need fix-up code whenever a use occurs in a module that precedes the module with the definition.\n\nDetailed requirements can be found in `req/lab1-linker.pdf`.\n\nTestable inputs and outputs can be found in `deliverables/tests`.\n\n## Source\nThis README file is adapted from Professor Yan Shvartzshnaider's [Operating System](https://cs.nyu.edu/courses/spring19/CSCI-UA.0202-002/) class, originally written by Professor Allan Gottlieb. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvic-lsh%2Fos-two-pass-linker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvic-lsh%2Fos-two-pass-linker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvic-lsh%2Fos-two-pass-linker/lists"}