Skip to content

Commit

Permalink
Error out on unsupported relocation entries
Browse files Browse the repository at this point in the history
This applies to both the PowerPC and RISC-V architectures, both of which have
tricky relocation types that `elf-edit` does not currently support. See #39 for
more information.
  • Loading branch information
RyanGlScott committed Jul 30, 2024
1 parent 5ff1859 commit fcda0a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/Data/ElfEdit/Relocations/PPC32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ ppc32Reloc tp nm c = (tp, (nm, c))
-- These values are derived from Figure 4-1 (Relocation Fields) of
-- http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf.
--
-- Note that the treatment of `low24` and `low14` here is not correct. See
-- Note that some of these values are not currently supported. See
-- https://github.com/GaloisInc/elf-edit/issues/39 for more information.

none :: Int
Expand All @@ -204,10 +204,10 @@ word30 :: Int
word30 = 30

low24 :: Int
low24 = 24
low24 = error "low24 relocation entries not currently supported"

low14 :: Int
low14 = 14
low14 = error "low14 relocation entries not currently supported"

half16 :: Int
half16 = 16
Expand Down
6 changes: 3 additions & 3 deletions src/Data/ElfEdit/Relocations/PPC64.hs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ ppc64Reloc tp nm c = (tp, (nm, c))
-- These values are derived from Section 4.5.1 (Relocation Types) of
-- https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.pdf.
--
-- Note that the treatment of `low24` and `low14` here is not correct. See
-- Note that some of these values are not currently supported. See
-- https://github.com/GaloisInc/elf-edit/issues/39 for more information.

none :: Int
Expand All @@ -471,10 +471,10 @@ word30 :: Int
word30 = 30

low24 :: Int
low24 = 24
low24 = error "low24 relocation entries not currently supported"

low14 :: Int
low14 = 14
low14 = error "low14 relocation entries not currently supported"

half16 :: Int
half16 = 16
Expand Down
18 changes: 9 additions & 9 deletions src/Data/ElfEdit/Relocations/RISCV.hs
Original file line number Diff line number Diff line change
Expand Up @@ -303,32 +303,32 @@ word64 = 64
-- 16-bit RVC instruction formats) of
-- https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf.
--
-- Note that the treatment of these variables is not correct. See
-- Note that these values are not currently supported. See
-- https://github.com/GaloisInc/elf-edit/issues/39 for more information.

bType :: Int
bType = 32
bType = error "B-Type fields not currently supported"

cbType :: Int
cbType = 16
cbType = error "CB-Type fields not currently supported"

cjType :: Int
cjType = 16
cjType = error "CJ-Type fields not currently supported"

iType :: Int
iType = 32
iType = error "I-Type fields not currently supported"

sType :: Int
sType = 32
sType = error "S-Type fields not currently supported"

uType :: Int
uType = 32
uType = error "U-Type fields not currently supported"

jType :: Int
jType = 32
jType = error "J-Type fields not currently supported"

uiType :: Int
uiType = 32
uiType = error "U+I-Type fields not currently supported"

-- This is a variable-length encoding, and it's unclear how to support this at
-- the moment.
Expand Down

0 comments on commit fcda0a5

Please sign in to comment.