Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Stefan Reuther Newsgroups: comp.arch.embedded Subject: Re: Patch fixed strings in .hex file Date: Tue, 16 Jan 2024 17:44:22 +0100 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 43mJVVKEotwTMbXaw4m8XQUs59PH/stnPIA/+J7b0g2LpIZgDJ Cancel-Lock: sha1:K3+tQj2q1wR6K/gP/WfdfxTnXEU= sha256:buKZBoehB1cND7rgKOMTUw0nehwXOMJUeYvCnImnJRM= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 Hamster/2.1.0.1538 In-Reply-To: Xref: csiph.com comp.arch.embedded:32132 Am 16.01.2024 um 13:19 schrieb pozz: > The build system is gcc, so I could search for s1 in the elf file. Do > you know of a tool that returns the address of a symbol in the elf or > map file? Last time I needed that, I hacked it up myself; at least back in 32-bit times, ELF was not that hard (but I had to do that anyway to convert ELF into something the controller could boot). > Could you suggest a better approach? Define your memory allocations explicitly. Instead of building a binary and hacking the strings, place the strings at a fixed address and regenerate the ELF or .hex file containing them from scratch. Whether you then give the fixed addresses a name using linker magic, or just cast pointers, is a matter of taste. Stefan