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] |
Hi folks, Currently, obj_sec_set_private_data is an object-dependent #define, called in subseg_get, and used solely by the elf object format outputter to get the ELF bfd new section hook called at the appropriate time. It is defined in obj-elf.h, which begins with this comment: /* Note that all macros in this file should be wrapped in #ifndef, for sake of obj-multi.h which includes this file. */ However, that doesn't help in this case, because there is no equivalent currently in obj-multi.h to override it. That means that obj_sec_set_private_data is defined to point to an ELF-specific function in multi-obj builds, which is called unconditionally in subseg_get, regardless of the actual target format selected at runtime. The attached patch resolves this problem by making obj_sec_set_private_data a new member of the format_ops structure, and only placing an entry for it in the elf format_ops. The problem of course does not arise in non-multi-obj builds, in which case it becomes an unconditional define for elf_obj_sec_set_private_data rather than a format_ops dereference, and obj-elf.h is only included in ELF-targetted builds. This patch is also a prerequisite for subsequent patches I will send to make multi-obj (and the rest of --enable-targets=all) work for cygwin and remove some of those #ifdef TE_PE from the top-level of gas. Currently running tests on i686-pc-cygwin native, and crossed to i386-linux-gnu, arm-elf and ppc-eabi[*], all with and without --enable-targets=all. OK to apply if no regressions? gas/ChangeLog 2006-04-30 Dave Korn <dave.korn@artimi.com> * obj.h (struct format_ops.obj_sec_set_private_data): New function pointer member to set bfd private data for subseg_get. * config/obj-aout.c (aout_format_ops): Initialise obj_sec_set_private_data to NULL as not used by this object format. * config/obj-coff.c (coff_format_ops): Likewise. * config/obj-ecoff.c (ecoff_format_ops): Likewise. * config/obj-elf.c (elf_obj_sec_set_private_data): New function allows subseg_get to set private bfd data for ELF objects only. (elf_format_ops): Initialise obj_sec_set_private_data to point to elf_obj_sec_set_private_data. * config/obj-elf.h (obj_sec_set_private_data): Redefine to point to elf_obj_sec_set_private_data if not defined (= not using multi-obj). * config/obj-multi.h (obj_sec_set_private_data): Define to use new format_op when multi-obj enabled. cheers, DaveK [*] - this may take some time :) if anyone wants be i'll be in the pub! -- Can't think of a witty .sigline today....
Attachment:
set-prv-data-patch.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |