From ae774b5e96831b2e9164d0e657d78dbe35ac5263 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 19 Aug 2024 00:35:51 +0200 Subject: [PATCH 1/3] Add 2 new constants --- src/elf.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/elf.rs b/src/elf.rs index c9c53bf1..0f2feb09 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -774,6 +774,10 @@ pub const SHF_TLS: u32 = 1 << 10; /// /// Compressed sections begin with one of the `CompressionHeader*` headers. pub const SHF_COMPRESSED: u32 = 1 << 11; +/// Section should not be garbage collected by the linker. +pub const SHF_GNU_RETAIN: u32 = 1 << 21; +/// Mbind section. +pub const SHF_GNU_MBIND: u32 = 1 << 24; /// OS-specific section flags. pub const SHF_MASKOS: u32 = 0x0ff0_0000; /// Processor-specific section flags. From 7a8eb3d3b65596a1ca3ea46b2671be9c3ef469f8 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 19 Aug 2024 07:32:08 +0200 Subject: [PATCH 2/3] Address comments --- crates/examples/src/readobj/elf.rs | 3 +++ src/elf.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/examples/src/readobj/elf.rs b/crates/examples/src/readobj/elf.rs index a8c0a56e..ad1f2a46 100644 --- a/crates/examples/src/readobj/elf.rs +++ b/crates/examples/src/readobj/elf.rs @@ -1443,6 +1443,9 @@ const FLAGS_SHF: &[Flag] = &flags!( SHF_GROUP, SHF_TLS, SHF_COMPRESSED, + SHF_GNU_RETAIN, + SHF_GNU_MBIND, + SHF_EXCLUDE, ); const FLAGS_SHF_MIPS: &[Flag] = &flags!( SHF_MIPS_GPREL, diff --git a/src/elf.rs b/src/elf.rs index 0f2feb09..541658f3 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -774,12 +774,12 @@ pub const SHF_TLS: u32 = 1 << 10; /// /// Compressed sections begin with one of the `CompressionHeader*` headers. pub const SHF_COMPRESSED: u32 = 1 << 11; +/// OS-specific section flags. +pub const SHF_MASKOS: u32 = 0x0ff0_0000; /// Section should not be garbage collected by the linker. pub const SHF_GNU_RETAIN: u32 = 1 << 21; /// Mbind section. pub const SHF_GNU_MBIND: u32 = 1 << 24; -/// OS-specific section flags. -pub const SHF_MASKOS: u32 = 0x0ff0_0000; /// Processor-specific section flags. pub const SHF_MASKPROC: u32 = 0xf000_0000; /// This section is excluded from the final executable or shared library. From 1779b99ab8af4206b7bbe3e1e60d19f5e271b38e Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 19 Aug 2024 07:40:55 +0200 Subject: [PATCH 3/3] Include testfiles change --- crates/examples/testfiles/elf/nostd-mipsel.o.readobj | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/examples/testfiles/elf/nostd-mipsel.o.readobj b/crates/examples/testfiles/elf/nostd-mipsel.o.readobj index d5fe089e..0cd14723 100644 --- a/crates/examples/testfiles/elf/nostd-mipsel.o.readobj +++ b/crates/examples/testfiles/elf/nostd-mipsel.o.readobj @@ -203,6 +203,7 @@ SectionHeader { Name: ".llvm_addrsig" (0x4B) Type: 0x6FFF4C03 Flags: 0x80000000 + SHF_EXCLUDE (0x80000000) SHF_MIPS_STRINGS (0x80000000) Address: 0x0 Offset: 0x118