pub struct Sections {
pub functions: bool,
pub data: bool,
}Expand description
Whether each function and each variable gets a section to itself.
Design: spec/11-asm-objects-debug.md section 11.3, and spec/04-driver-and-cli.md section 4.7
for the flags that ask for it.
A linker can drop a section nothing reaches and cannot drop half of one, so a file whose
functions share a section keeps every function that file defines in the output as soon as any
one of them is called. Splitting them is what makes --gc-sections do anything, which is how an
embedded image or a kernel gets small, and it is the whole of what these two flags are for. The
cost is a section header per name, which is why it is asked for rather than always done.
Not one flag, because gcc has two and a build that wants one of them and not the other is a build that measured something. Splitting the code is nearly free at link time; splitting the data can defeat the linker’s ordering of what is next to what.
Fields§
§functions: bool-ffunction-sections. Each function in .text.<name> rather than all of them in .text.
data: bool-fdata-sections. Each variable in a section named after it rather than in the one its
contents would otherwise have chosen.
Implementations§
Trait Implementations§
impl Copy for Sections
impl Eq for Sections
impl StructuralPartialEq for Sections
Auto Trait Implementations§
impl Freeze for Sections
impl RefUnwindSafe for Sections
impl Send for Sections
impl Sync for Sections
impl Unpin for Sections
impl UnsafeUnpin for Sections
impl UnwindSafe for Sections
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.