This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Allow memory region LENGTH expression to contain names


Hi,

I encountered the restriction referred to in this bug:

http://sources.redhat.com/bugzilla/show_bug.cgi?id=518

so I came up with a patch which allows one to refer to pre-defined
symbols in the LENGTH expression (but not for the ORIGIN yet). Basically
the idea is to delay evaluation of the expression until the last
possible moment and, if you are lucky, then all your symbols will be
available. I'm no ld expert so doubtless the details could be improved.
The patch was made against 2.17 release and also contains some comments
which are mostly for my own merge purposes (sorry). It works as expected
for me (i.e. I'm able to use expressions such as the ones in the bug
above).

I attempted to use a similar approach for the ORIGIN expression (and the
'current' field) but unfortunately this didn't work because the origin
is first needed (at least in my example) during the mark phase when the
symbols apparently aren't available yet.

Any suggestions for how to improve on this? It's really useful to be
able to specify the memory size on the command line using defsym but I
really need even more flexibility...

Cheers,

Robert

Attachment: ld-patch.txt
Description: ld-patch.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]