RE: Specifying variable addresses manually in MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rena <hyperhacker@xxxxxxxxx> writes:
> I'm writing patches for a Nintendo 64 game. I can assemble some code
> and have the game load and run it, and I've identified several
> functions and variables in the existing binary.
> 
> What I want to do now is write my patches in C instead of assembly. I
> can easily declare function pointers to use the existing functions,
> but I can't find a way to declare variables at a specific address.
> Apparently ARM supports an 'at' attribute but that's not implemented
> for any other platforms? Otherwise I'll have to use pointers for

I can't see any evidence of an 'at' attribute for GCC. There are no
ARM specific variable attributes and no 'at' listed in function
attributes.

https://gcc.gnu.org/onlinedocs/gcc/ARM-Function-Attributes.html#ARM-Function-Attributes

How does this feature work and in what tools?

> everything (ugly) or define a bunch of variables in the link script
> (hard to maintain).
> 
> Is such a feature available for MIPS?

I'm not sure if this is possible in a relocatable ELF object for any
architecture but there are plenty of unusual features I won't be aware
of.

I assume you don’t want to do this in a linker script because you don't
want to modify the default script? If you have a custom script for this
work anyway I'm not sure I understand why it would be harder to maintain
a set of symbols in there vs some magic in a C file?

You can avoid the need to modify the link script by using linker command
line options to define symbols at absolute addresses (--defsym) if that
is a better option for you?

Hope that helps,
Matthew




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux