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]

Re: [RFC] slipping in symbol prefixes automagically via PROVIDE() in linker scripts


Hi Mike,

with the new binutils-2.17, it'd be good to switch to using the generic elf.sc file ... but this _ prefix is standing in the way

Which symbols in the elf.sc need this prefix and do not already have it ? I looked through the file and it seems that most symbols are provided in an underscore prefixed version and a non-underscore prefixed version. Or is it that you want to have *double* underscore prefixed versions and single underscore prefixed versions ? (If so, are the double underscore prefixed versions really necessary ?)


... there seems to be two
ways to deal with this at the moment:
- copy elf.sc to bfin.sc again and just insert the _ symbols as needed
- tweak PROVIDE() to automatically insert a configurable prefix

The cleanest way would be to edit elf.sc so that PROVIDEd symbols had an optional prefix. eg change:


${RELOCATING+${END_SYMBOLS-_end = .; PROVIDE (end = .);}}

to

${RELOCATING+${END_SYMBOLS-_end = .; PROVIDE (${PREFIX}end = .);}}

and in your bfin.sh file define PREFIX as "_".

from what i can tell after reading the ld docs, PROVIDE is generally for setting up automatic symbol values when referenced via higher level code (like C) ... so making PROVIDE "smarter" and having it insert the same prefixes that higher level language parsers seems like a good idea to me :)

Changing PROVIDE would be a bad idea in my opinion. It would prevent linker scripts from being able to define symbols outside of the namespaces of higher level languages, and this might be needed. (eg for example for defining symbols used by ROM monitors to handle program start up).


Cheers
  Nick


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