-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from GaloisInc/elf-edit-T35
`macaw-base`: Resolve PPC{32,64} relocations
- Loading branch information
Showing
15 changed files
with
315 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule elf-edit
updated
10 files
+3 −1 | elf-edit.cabal | |
+6 −0 | src/Data/ElfEdit/Prim.hs | |
+279 −0 | src/Data/ElfEdit/Relocations/PPC32.hs | |
+615 −0 | src/Data/ElfEdit/Relocations/PPC64.hs | |
+7 −1 | tests/Makefile | |
+112 −0 | tests/Test.hs | |
+3 −0 | tests/ppc32-relocs.c | |
+ − | tests/ppc32-relocs.elf | |
+3 −0 | tests/ppc64-relocs.c | |
+ − | tests/ppc64-relocs.elf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) { | ||
printf("Hello, %s!\n", "World"); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.file "test-relocs.c" | ||
.machine ppc | ||
.section ".text" | ||
.section .rodata | ||
.align 2 | ||
.LC0: | ||
.string "World" | ||
.align 2 | ||
.LC1: | ||
.string "Hello, %s!\n" | ||
.section ".text" | ||
.align 2 | ||
.globl main | ||
.type main, @function | ||
main: | ||
.LFB0: | ||
.cfi_startproc | ||
stwu 1,-16(1) | ||
.cfi_def_cfa_offset 16 | ||
mflr 0 | ||
stw 0,20(1) | ||
stw 31,12(1) | ||
.cfi_offset 65, 4 | ||
.cfi_offset 31, -4 | ||
mr 31,1 | ||
.cfi_def_cfa_register 31 | ||
lis 9,.LC0@ha | ||
la 4,.LC0@l(9) | ||
lis 9,.LC1@ha | ||
la 3,.LC1@l(9) | ||
crxor 6,6,6 | ||
bl printf | ||
li 9,0 | ||
mr 3,9 | ||
addi 11,31,16 | ||
lwz 0,4(11) | ||
mtlr 0 | ||
lwz 31,-4(11) | ||
.cfi_def_cfa 11, 0 | ||
mr 1,11 | ||
.cfi_restore 31 | ||
.cfi_def_cfa_register 1 | ||
blr | ||
.cfi_endproc | ||
.LFE0: | ||
.size main,.-main | ||
.ident "GCC: (Ubuntu 8.4.0-3ubuntu1) 8.4.0" | ||
.section .note.GNU-stack,"",@progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
R { funcs = [(0x10000210, [ (0x10000210, 44) | ||
, (0x1000023c, 32) | ||
]) | ||
] | ||
, ignoreBlocks = [0x10000260] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:20.04 | ||
RUN apt update && apt install -y locales \ | ||
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 | ||
ENV LANG en_US.utf8 | ||
RUN apt install -y gcc-powerpc64-linux-gnu binutils-multiarch build-essential | ||
RUN addgroup --gid 1000 theuser | ||
RUN adduser --disabled-password --gecos "" --force-badname --gid 1000 --uid 1000 theuser | ||
USER theuser | ||
WORKDIR /build | ||
ENTRYPOINT ["make"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
To build the binaries in this directory with the Docker container, run: | ||
|
||
``` | ||
docker build . -t ppc64-cross | ||
docker run -v $(pwd):/build --rm ppc64-cross | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <stdio.h> | ||
|
||
int main(void) { | ||
printf("Hello, %s!\n", "World"); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.file "test-relocs.c" | ||
.section ".text" | ||
.section .rodata | ||
.align 3 | ||
.LC0: | ||
.string "World" | ||
.align 3 | ||
.LC1: | ||
.string "Hello, %s!\n" | ||
.section ".text" | ||
.align 2 | ||
.globl main | ||
.section ".opd","aw" | ||
.align 3 | ||
main: | ||
.quad .L.main,.TOC.@tocbase,0 | ||
.previous | ||
.type main, @function | ||
.L.main: | ||
.LFB0: | ||
.cfi_startproc | ||
mflr 0 | ||
std 0,16(1) | ||
std 31,-8(1) | ||
stdu 1,-128(1) | ||
.cfi_def_cfa_offset 128 | ||
.cfi_offset 65, 16 | ||
.cfi_offset 31, -8 | ||
mr 31,1 | ||
.cfi_def_cfa_register 31 | ||
addis 4,2,.LC0@toc@ha | ||
addi 4,4,.LC0@toc@l | ||
addis 3,2,.LC1@toc@ha | ||
addi 3,3,.LC1@toc@l | ||
bl printf | ||
nop | ||
li 9,0 | ||
mr 3,9 | ||
addi 1,31,128 | ||
.cfi_def_cfa 1, 0 | ||
ld 0,16(1) | ||
mtlr 0 | ||
ld 31,-8(1) | ||
blr | ||
.long 0 | ||
.byte 0,0,0,1,128,1,0,1 | ||
.cfi_endproc | ||
.LFE0: | ||
.size main,.-.L.main | ||
.ident "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
R { funcs = [(0x10000300, [ (0x10000300, 40) | ||
, (0x10000328, 32) | ||
]) | ||
] | ||
, ignoreBlocks = [0x100002e0] | ||
} |