|
|
|
@ -156,6 +156,7 @@ Basic
|
|
|
|
|
What kind of global/static C variables does the `.data` section of an ELF file contain?
|
|
|
|
|
Back: Those initialized to a non-zero value.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832070-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -164,6 +165,7 @@ Basic
|
|
|
|
|
Which ELF section contains global C variables initialized to a non-zero value?
|
|
|
|
|
Back: `.data`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832073-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -172,6 +174,7 @@ Basic
|
|
|
|
|
Which ELF section contains static C variables initialized to a non-zero value?
|
|
|
|
|
Back: `.data`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832075-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -180,6 +183,7 @@ Basic
|
|
|
|
|
Which ELF section contains local C variables initialized to a non-zero value?
|
|
|
|
|
Back: N/A.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832076-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -191,6 +195,7 @@ int foo = 1;
|
|
|
|
|
```
|
|
|
|
|
Back: `.data`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188095-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -204,6 +209,7 @@ int foo() {
|
|
|
|
|
```
|
|
|
|
|
Back: N/A.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188101-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -217,9 +223,81 @@ int foo() {
|
|
|
|
|
```
|
|
|
|
|
Back: `.data`.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188110-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
### `.tdata`
|
|
|
|
|
|
|
|
|
|
Thread-local global and static C variables initialized to a non-zero value.
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
What kind of global/static C variables does the `.tdata` section of an ELF file contain?
|
|
|
|
|
Back: Thread-local variables initialized to a non-zero value.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402941-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which ELF section contains global thread-local C variables initialized to a non-zero value?
|
|
|
|
|
Back: `.tdata`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402945-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which ELF section contains static thread-local C variables initialized to a non-zero value?
|
|
|
|
|
Back: `.tdata`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402949-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `foo` end up in?
|
|
|
|
|
```c
|
|
|
|
|
_Thread_local int foo = 1;
|
|
|
|
|
```
|
|
|
|
|
Back: `.tdata`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402952-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `bar` end up in?
|
|
|
|
|
```c
|
|
|
|
|
int foo() {
|
|
|
|
|
static _Thread_local int bar = 1;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Back: `.tdata`.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402957-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `bar` end up in?
|
|
|
|
|
```c
|
|
|
|
|
int foo() {
|
|
|
|
|
_Thread_local int bar = 1;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Back: N/A. Compilation error - `bar` must have global storage.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402961-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
### `.bss`
|
|
|
|
|
|
|
|
|
|
Uninitialized global and static C variables, along with any global or static variables initialized to zero.
|
|
|
|
@ -229,6 +307,7 @@ Basic
|
|
|
|
|
What kind of global/static C variables does the `.bss` section of an ELF file contain?
|
|
|
|
|
Back: Unitialized variables or those initialized to zero.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832077-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -237,6 +316,7 @@ Basic
|
|
|
|
|
Which ELF section contains uninitialized global C variables?
|
|
|
|
|
Back: `.bss`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832078-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -245,6 +325,7 @@ Basic
|
|
|
|
|
Which ELF section contains global C variables initialized to a zero value?
|
|
|
|
|
Back: `.bss`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832079-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -253,6 +334,7 @@ Basic
|
|
|
|
|
Which two ELF sections contain global/static C variables?
|
|
|
|
|
Back: `.data` and `.bss`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734368832080-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -264,6 +346,7 @@ int foo = 0;
|
|
|
|
|
```
|
|
|
|
|
Back: `.bss`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188113-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -275,14 +358,16 @@ int foo;
|
|
|
|
|
```
|
|
|
|
|
Back: `.bss`
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188117-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Both `.bss` and `.data` hold what kind of C variables?
|
|
|
|
|
Back: Global or static C variables.
|
|
|
|
|
Back: Global or static variables.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188121-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
@ -328,9 +413,115 @@ int foo() {
|
|
|
|
|
```
|
|
|
|
|
Back: `.bss`.
|
|
|
|
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734369188106-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
### `.tbss`
|
|
|
|
|
|
|
|
|
|
Uninitialized global and static thread-local C variables, along with any global or static thread-local variables initialized to zero.
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
What kind of global/static C variables does the `.tbss` section of an ELF file contain?
|
|
|
|
|
Back: Unitialized thread-local variables or those initialized to zero.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402964-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which ELF section contains uninitialized thread-local global C variables?
|
|
|
|
|
Back: `.tbss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402968-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which ELF section contains global thread-local C variables initialized to a zero value?
|
|
|
|
|
Back: `.tbss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402971-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which two ELF sections contain global/static thread-local C variables?
|
|
|
|
|
Back: `.tdata` and `.bss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402975-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `foo` end up in?
|
|
|
|
|
```c
|
|
|
|
|
_Thread_local int foo = 0;
|
|
|
|
|
```
|
|
|
|
|
Back: `.tbss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402980-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `foo` end up in?
|
|
|
|
|
```c
|
|
|
|
|
_Thread_local int foo;
|
|
|
|
|
```
|
|
|
|
|
Back: `.tbss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402984-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Both `.tbss` and `.tdata` hold what kind of C variables?
|
|
|
|
|
Back: Global or static thread-local variables.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402989-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Which of `.tdata` and/or `.tbss` is considered a "placeholder"?
|
|
|
|
|
Back: `.tbss`
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402993-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
How does the size of the `.tbss` section compare to that of the `.tdata` section?
|
|
|
|
|
Back: Less than or equal since the `.tbss` section is always empty.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745402997-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
%%ANKI
|
|
|
|
|
Basic
|
|
|
|
|
Consider the following translation unit. Which ELF section will `bar` end up in?
|
|
|
|
|
```c
|
|
|
|
|
int foo() {
|
|
|
|
|
static _Thread_local int bar = 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Back: `.tbss`.
|
|
|
|
|
Reference: Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|
|
|
|
|
Tags: c17
|
|
|
|
|
<!--ID: 1734745403003-->
|
|
|
|
|
END%%
|
|
|
|
|
|
|
|
|
|
### `.symtab`
|
|
|
|
|
|
|
|
|
|
A symbol table with information about functions and global variables defined and referenced in the program.
|
|
|
|
@ -451,4 +642,5 @@ END%%
|
|
|
|
|
|
|
|
|
|
## Bibliography
|
|
|
|
|
|
|
|
|
|
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
|
|
|
|
* Ulrich Drepper, “ELF Handling For Thread-Local Storage,” n.d.
|