Skip to main content

Compress

Enum Compress 

Source
pub enum Compress {
    None,
    Zlib,
    ZlibGnu,
    Zstd,
}
Expand description

How the debug sections are compressed, which is what -gz asks.

Debug information is much larger than the code it describes and almost never read, so an ELF section holding it may be stored compressed: the section keeps its name, gains the SHF_COMPRESSED flag and starts with a header saying what it decompresses to, and every reader that understands the flag unpacks it on the way in. A distribution that ships debug symbols for everything it builds saves more from this than from anything else it passes.

This compiler writes no debug sections at all yet, so every answer here produces the same bytes, and an object built with -gz=zstd is identical to one built without the flag. It is recorded rather than dropped for the reason section 4.1 gives for the rest of the family: the answer has to be sitting in the options on the day rucc-debug has something to compress, and a build that asked for it and got silence would have no way of noticing the difference.

Variants§

§

None

-gz=none, and what a command line that says nothing gets. gcc’s default is the same.

§

Zlib

-gz and -gz=zlib. The ELF way, with the SHF_COMPRESSED flag and an Elf64_Chdr in front of the data. Bare -gz means this one, which is worth knowing because the manual describes the flag without saying so.

§

ZlibGnu

-gz=zlib-gnu. The older way, where the section is renamed from .debug_info to .zdebug_info and carries ZLIB and a length instead of a real header. Kept because binutils still reads it and some build systems still ask for it by name.

§

Zstd

-gz=zstd. The same arrangement as Zlib with a different algorithm in the header, which packs debug information smaller and unpacks it faster.

Implementations§

Source§

impl Compress

Source

pub const fn as_str(self) -> &'static str

The spelling this is asked for by, without the -gz= in front of it.

Trait Implementations§

Source§

impl Clone for Compress

Source§

fn clone(&self) -> Compress

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Compress

Source§

impl Debug for Compress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Compress

Source§

fn default() -> Compress

Returns the “default value” for a type. Read more
Source§

impl Display for Compress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Compress

Source§

impl FromStr for Compress

Source§

fn from_str(s: &str) -> Result<Self, ()>

Parses the part after -gz=. Bare -gz is not this function’s business because there is nothing after the flag to hand it.

Source§

type Err = ()

The associated error which can be returned from parsing.
Source§

impl Hash for Compress

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Compress

Source§

fn cmp(&self, other: &Compress) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Compress

Source§

fn eq(&self, other: &Compress) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Compress

Source§

fn partial_cmp(&self, other: &Compress) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Compress

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.