This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Add make_elf_object target hooks.
- From: Ian Lance Taylor <iant at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 18 Aug 2009 07:34:43 -0700
- Subject: Re: [PATCH][GOLD] Add make_elf_object target hooks.
- References: <498552560908171552w266b6278gfc92e6032b007f88@mail.gmail.com>
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> + gold_fatal(_("%s: unsupported ELF machine number %d"),
> + name.c_str(), ehdr.get_e_machine());
> return NULL;
No need to call return after calling gold_fatal.
> + obj->setup(ehdr);
It no longer makes sense for Object::setup to take an ehdr parameter.
It should take a target parameter, and avoid looking up the target
again.
> + // make_elf_object hooks. There are four versions of these for
> + // different address sizes and endianities.
> +
> +#ifdef HAVE_TARGET_32_LITTLE
> + // Virtual functions which may be overriden by the child class.
> + virtual Object*
> + do_make_elf_object(const std::string& name, Input_file* input_file,
> + off_t offset, const elfcpp::Ehdr<32, false>& ehdr);
> +#endif
> +
> +#ifdef HAVE_TARGET_32_BIG
> + // Virtual functions which may be overriden by the child class.
> + virtual Object*
> + do_make_elf_object(const std::string& name, Input_file* input_file,
> + off_t offset, const elfcpp::Ehdr<32, true>& ehdr);
> +#endif
> +
> +#ifdef HAVE_TARGET_64_LITTLE
> + // Virtual functions which may be overriden by the child class.
> + virtual Object*
> + do_make_elf_object(const std::string& name, Input_file* input_file,
> + off_t offset, const elfcpp::Ehdr<64, false>& ehdr);
> +#endif
> +
> +#ifdef HAVE_TARGET_64_BIG
> + // Virtual functions which may be overriden by the child class.
> + virtual Object*
> + do_make_elf_object(const std::string& name, Input_file* input_file,
> + off_t offset, const elfcpp::Ehdr<64, true>& ehdr);
> +#endif
Interesting problem. I wonder if there is anything we can do to make
that easier to write.
Ian