elf 0.29 → 0.30
raw patch · 4 files changed
+18/−5 lines, 4 filesbinary-addedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- elf.cabal +4/−3
- src/Data/Elf.hs +2/−2
- testdata/vdso binary
- tests/Data/ElfSpec.hs +12/−0
elf.cabal view
@@ -1,5 +1,5 @@ Name: elf-Version: 0.29+Version: 0.30 License: BSD3 License-file: LICENSE Category: Data@@ -14,10 +14,11 @@ Description: Parser for ELF object format. Extra-Source-Files: testdata/tiny testdata/bloated testdata/HOWTO testdata/bloated.cpp testdata/tiny.asm- testdata/empty+ testdata/empty testdata/vdso tested-with:- GHC == 8.4.3+ GHC == 8.6.2+ , GHC == 8.4.4 , GHC == 8.2.2 , GHC == 8.0.2
src/Data/Elf.hs view
@@ -674,7 +674,7 @@ let secs = symbolTableSections e in map (getSymbolTableEntries e) secs --- | Assumes the given section is a symbol table, type SHT_SYMTAB+-- | Assumes the given section is a symbol table, type SHT_SYMTAB, or SHT_DYNSYM -- (guaranteed by parseSymbolTables). getSymbolTableEntries :: Elf -> ElfSection -> [ElfSymbolTableEntry] getSymbolTableEntries e s = go decoder (L.fromChunks [elfSectionData s])@@ -717,7 +717,7 @@ in if B.null def then Nothing else Just def symbolTableSections :: Elf -> [ElfSection]-symbolTableSections e = filter ((== SHT_SYMTAB) . elfSectionType) (elfSections e)+symbolTableSections e = filter ((`elem` [SHT_SYMTAB, SHT_DYNSYM]) . elfSectionType) (elfSections e) -- | Gets a single entry from the symbol table, use with runGetMany. getSymbolTableEntry :: Elf -> Maybe ElfSection -> Get ElfSymbolTableEntry
+ testdata/vdso view
binary file changed (absent → 8192 bytes)
tests/Data/ElfSpec.hs view
@@ -23,9 +23,11 @@ emptyContents <- runIO $ getBinaryFileContents "./testdata/empty" tinyContents <- runIO $ getBinaryFileContents "./testdata/tiny" bloatedContents <- runIO $ getBinaryFileContents "./testdata/bloated"+ dynsymContents <- runIO $ getBinaryFileContents "./testdata/vdso" let tinyElf = parseElf tinyContents bloatedElf = parseElf bloatedContents+ dynsymElf = parseElf dynsymContents describe "parseElf" $ do -- TODO: That was the original only test in this package. This test@@ -129,3 +131,13 @@ it "parses symbol type" $ do fmap steType initSymbol `shouldBe` Just STTFunc fmap steType fnameSymbol `shouldBe` Just STTFile+ describe "parse DynSym symbols" $ do+ let dynSymbols = parseSymbolTables dynsymElf+ it "parses dyn symbol table" $ do+ dynSymbols `shouldNotBe` []+ it "parse (x86_64) vdso dyn symbols" $ do+ let dynSyms = concat dynSymbols+ filter (\e -> (snd . steName) e == (Just . C.pack) "__vdso_time") dynSyms `shouldNotBe` []+ filter (\e -> (snd . steName) e == (Just . C.pack) "__vdso_getcpu") dynSyms `shouldNotBe` []+ filter (\e -> (snd . steName) e == (Just . C.pack) "__vdso_clock_gettime") dynSyms `shouldNotBe` []+ filter (\e -> (snd . steName) e == (Just . C.pack) "__vdso_gettimeofday") dynSyms `shouldNotBe` []