This is the mail archive of the binutils@sources.redhat.com 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] |
The attached file contains a patch for an sh/sh64 linker problem in which the linker allocates space for dynamic relocations, but then does not initialize that space. The patch is very simple, though the explanation is rather convoluted. Space for dynamic relocations is calculated by sh_elf_check_relocs(), before the information in a version script has been processed. At this time a symbol can appear to be globally visible, and so a relocation which references it has to be resolved dynamically, so space is set aside for that dynamic relocation. After this, the version script is processed, and some symbols may be forced local. The contents of the dynamic relocations are actually written by sh_elf_relocate_section(). A symbol that originally appeared to be global may by now have been forced local. A PC-relative relocation can be resolved statically for such a symbol, there is no longer any need for the dynamic relocation. So although space for a dynamic relocation was allocated, it is now unnecessary, and is left uninitialized. This patch simply zero-initializes the space allocated for the dynamic relocations, which means they are set to R_SH_NONE, rather than random garbage. I've included a test for sh64 only, though I think the problem will also occur on sh, I haven't been able to construct a test case. (I should add that this change was also present in the following patch submitted by Kaz Kojima: http://sources.redhat.com/ml/binutils/2002-06/msg00765.html I'm still hoping to provide the required changes to get Kaz' patch working for sh64 and accepted at some stage, but first I want to get some simpler patches done...) Steve. -- Stephen Clarke, Principal Engineer, SuperH Inc. Phone:1-408-273-3146, Fax:1-408-273-3199, mailto:Stephen.Clarke@superh.com Mail: SuperH Inc., 405 River Oaks Pkwy, San Jose, CA 95134, USA.
Attachment:
zalloc.patch
Description: zalloc.patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |