-
Notifications
You must be signed in to change notification settings - Fork 188
Cdl 01 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Cdl 01 #155
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mie imi place foarte mult ala buzaul de la buzau si mai ales de la buzau si de la buzau si nu numai de la buzau dar cel mai important de la buzau si de la buzau si de la buzau si de la buzau si de la buzau si de la buzau si de la buzau si de la buzau si de la | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ Diferența este că acum, folosim linkare dinamică în loc de linkare statică | |
| Pentru aceasta, am renunțat la argumentul `-static` folosit la linkare. | ||
|
|
||
| Pentru acest exemplu, obținem un singur executabil `main`, din legarea statică cu biblioteca `libinc.a` și legarea dinamică cu biblioteca standard C. | ||
| Similar exemplului din directorul `05-static/, folosim comanda `make` pentru a obține executabilul `main`: | ||
| Similar exemplului din directorul `05-static/`, folosim comanda `make` pentru a obține executabilul `main`: | ||
|
|
||
| ```console | ||
| [..]/06-dynamic$ ls | ||
|
|
@@ -39,11 +39,11 @@ main: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically link | |
|
|
||
| [..]/06-dynamic$ file ../05-static/main | ||
| ../05-static/main: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=60adf8390374c898998c0b713a8b1ea0c255af38, not stripped | ||
| `` | ||
| ``` | ||
|
|
||
| Fișierul executabil `main` obținut prin linkare dinamică are un comportament identic fișierului executabil `main` obținut prin linkare statică. | ||
| Observăm că dimensiunea sa este mult mai redusă: ocupă `7 KB` comparativ cu `600 KB` cât avea varianta sa statică. | ||
| De asemenea, folosind utilitarul `file`, aflăm că este executabil obținut prin linkare dinamică (*dynamically linked*), în vreme cel obținut în exemplul anterior este executabil obținut prin linkare statică (*statically linked). | ||
| De asemenea, folosind utilitarul `file`, aflăm că este executabil obținut prin linkare dinamică (*dynamically linked*), în vreme cel obținut în exemplul anterior este executabil obținut prin linkare statică (*statically linked*). | ||
|
|
||
| Investigăm simbolurile executabilului: | ||
|
|
||
|
|
@@ -66,7 +66,7 @@ Investigăm simbolurile executabilului: | |
|
|
||
| Simbolurile obținute din modulul obiect `main.o` și din biblioteca statică `libinc.o` sunt rezolvate și au adrese stabilite. | ||
| Observăm că folosirea bibliotecii standard C a dus la existența simboblului `_start`, care este entry pointul programului. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You missed "simboblului". |
||
| Dar, simbolurile din biblioteca standard C, (`printf`, __libc_start_main`) sunt marcate ca nedefinite (`U`). | ||
| Dar, simbolurile din biblioteca standard C, (`printf`, `__libc_start_main`) sunt marcate ca nedefinite (`U`). | ||
| Aceste simboluri nu sunt prezente în executabil: rezolvarea, stabilirea adreselor și relocarea lor se va realiza mai târziu, la încărcare (load time). | ||
|
|
||
| La încărcare, o altă componentă software a sistemului, loaderul / linkerul dinamic, se va ocupa de: | ||
|
|
@@ -77,7 +77,7 @@ La încărcare, o altă componentă software a sistemului, loaderul / linkerul d | |
|
|
||
| Putem investiga bibliotecile dinamice folosite de un executabil prin intermediul utilitarului `ldd`: | ||
|
|
||
| ``console | ||
| ```console | ||
| [..]/06-dynamic$ ldd main | ||
| linux-gate.so.1 (0xf7f97000) | ||
| libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7d8a000) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #include <iostream> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is |
||
|
|
||
| int main() { | ||
| std::cout << "Hello, World!" << std::endl; | ||
| return 0; | ||
| } | ||
|
|
||
| class github { | ||
| public: | ||
| void print() { | ||
| std::cout << "Hello, GitHub!" << std::endl; | ||
| } | ||
| void | ||
| github() { | ||
| print(); | ||
|
|
||
| } | ||
| }; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?