Skip to content

Commit

Permalink
elfIsPie: Clarify Haddocks (especially around Permissions argument)
Browse files Browse the repository at this point in the history
Taking action on the suggestion in
#47 (comment).
  • Loading branch information
RyanGlScott committed Jan 7, 2025
1 parent 872f89f commit b584835
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Data/ElfEdit/Dynamic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,14 @@ dynamicEntries d cl dynamic = elfClassInstances cl $ runDynamicParser d cl $ do
-- | Returns 'True' if the supplied 'ElfHeaderInfo' describes a
-- position-independent executable (PIE). The approach used here is adapted from
-- the source code for the @file@ binutils program, which was in turn summarized
-- here: https://unix.stackexchange.com/a/435038
-- here: https://unix.stackexchange.com/a/435038. In brief:
--
-- * A dynamically linked executable is a PIE if it contains a certain value in
-- its DT_FLAGS_1 dynamic section entry, or (if it lacks the certain value)
-- the file has executable permissions. The file permission fallback is why
-- this function requires 'Permissions' as an argument.
--
-- * Non-dynamically-linked executables are not PIEs.
elfIsPie :: forall w. Permissions -> ElfHeaderInfo w -> Bool
elfIsPie perms ehi =
case headerType hdr of
Expand Down

0 comments on commit b584835

Please sign in to comment.