From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- roms/seabios-hppa/scripts/ldnoexec.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 roms/seabios-hppa/scripts/ldnoexec.py (limited to 'roms/seabios-hppa/scripts/ldnoexec.py') diff --git a/roms/seabios-hppa/scripts/ldnoexec.py b/roms/seabios-hppa/scripts/ldnoexec.py new file mode 100755 index 000000000..60bed0788 --- /dev/null +++ b/roms/seabios-hppa/scripts/ldnoexec.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# Script to remove EXEC flag from an ELF file +# +# Copyright (C) 2020 Kevin O'Connor +# +# This file may be distributed under the terms of the GNU GPLv3 license. +import optparse + +FLAG_OFFSET = 16 + +def main(): + # Parse command-line arguments + usage = "%prog " + opts = optparse.OptionParser(usage) + options, args = opts.parse_args() + if len(args) != 2: + opts.error("Incorrect number of arguments") + infilename, outfilename = args + # Read input + f = open(infilename, "rb") + srcdata = f.read() + f.close() + # Update + outdata = bytearray(srcdata) + outdata[FLAG_OFFSET] = 0x01 # change ET_EXEC to ET_REL + # Write output + f = open(outfilename, "wb") + f.write(outdata) + f.close() + +if __name__ == '__main__': + main() -- cgit 1.2.3-korg