Skip to content

Commit

Permalink
Merge pull request #55 from chaoticgd/ghidra11.0.1
Browse files Browse the repository at this point in the history
Add Ghidra 11.0.1 support, fix relocation issue
  • Loading branch information
chaoticgd committed Feb 2, 2024
2 parents 51cded4 + 8325b9b commit e7c6382
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ghidra: ["11.0"]
ghidra: ["11.0.1"]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ghidra: ["11.0"]
ghidra: ["11.0.1"]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ghidra: ["11.0"]
ghidra: ["11.0.1"]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v2.1.13

- Added support for Ghidra 11.0.1.
- Prevent relocations from being applied incorrectly for statically linked executable files that still have a relocation table.

## v2.1.12

- Added support for Ghidra 11.0.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This extension is based on the original [ghidra-emotionengine](https://github.co
- Recover data types, functions and global variables from ELF files with `.mdebug` sections with the included STABS Analyzer.
- Import PCSX2 save states.
- Fix references to global variables with the MIPS-R5900 Constant Reference Analyzer.
- Support for Ghidra 11.0.
- Support for Ghidra 11.0.1.

## Installation

Expand Down
17 changes: 16 additions & 1 deletion os/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,37 @@ set -e
# Downloads a release of ccc and puts all the stdump executables in the right
# places. This file is called by the CI workflow for putting out new releases.

pushd $(dirname -- "$0")

version='v1.2.1'

pushd $(dirname -- "$0")
cat > shasums.txt <<EOF
7fc40cb63d32ac7b363733d9dab586f10e0c44afd79a4dc3bbe93c32d1d1b61e ccc_v1.2.1_linux.zip
ab7d71b4a5255196a42728d97332548c9fabd213c9959dfc1edba243aeab9328 ccc_v1.2.1_mac.zip
1824cf630c339918d4b5a5d8c331e20f2dc08511774cf0c878ae5b2037e8962f ccc_v1.2.1_windows.zip
EOF

rm -f "ccc_$(echo $version)_linux.zip"
rm -f "ccc_$(echo $version)_mac.zip"
rm -f "ccc_$(echo $version)_windows.zip"

wget "https://github.com/chaoticgd/ccc/releases/download/$(echo $version)/ccc_$(echo $version)_linux.zip"
wget "https://github.com/chaoticgd/ccc/releases/download/$(echo $version)/ccc_$(echo $version)_mac.zip"
wget "https://github.com/chaoticgd/ccc/releases/download/$(echo $version)/ccc_$(echo $version)_windows.zip"

shasum -a 256 --check shasums.txt

mkdir -p linux_x86_64
mkdir -p mac_x86_64
mkdir -p win_x86_64

unzip -j "ccc_$(echo $version)_linux.zip" "ccc_$(echo $version)_linux/stdump" -d linux_x86_64
unzip -j "ccc_$(echo $version)_mac.zip" "ccc_$(echo $version)_mac/stdump" -d mac_x86_64
unzip -j "ccc_$(echo $version)_windows.zip" "ccc_$(echo $version)_windows/stdump.exe" -d win_x86_64

rm -f "ccc_$(echo $version)_linux.zip"
rm -f "ccc_$(echo $version)_mac.zip"
rm -f "ccc_$(echo $version)_windows.zip"
rm shasums.txt

popd
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public boolean canRelocate(ElfHeader elf) {
@Override
public RelocationResult relocate(ElfRelocationContext elfRelocationContext, ElfRelocation relocation,
Address relocationAddress) throws MemoryAccessException {
// Some versions of the Metrowerks compiler produced relocation tables
// in statically linked executables. We want to disable relocation in
// those cases.
if(elfRelocationContext.getElfHeader().isExecutable()) {
return RelocationResult.SKIPPED;
}

Program program = elfRelocationContext.getProgram();
Memory memory = program.getMemory();
MessageLog log = elfRelocationContext.getLog();
Expand Down

0 comments on commit e7c6382

Please sign in to comment.