extending elf32-i386 BFD backend

Graeme Peterson gp@qnx.com
Thu Mar 28 11:49:00 GMT 2002


Hi, all.

I have all of the qnx6 x86 support in place, but I would
like some feedback on the way I did it before submitting
a patch for your consideration.

As I mentioned in my last e-mail, I wanted to extend the
elf32-i386 backend, without copying the contents, and thus
missing out on any future updates.

I did this by moving all but the last line of elf32-i386.c
into a new file elf32-i386.h, which is then included at the
top of both elf32-i386.c, and elf32-i386qnx.c.


- I moved elf32-i386.c to elf32-i386.h, and removed 
  the last line "#include elf32-target.h"

- I created an elf32-i386.c that only has 2 lines:
	#include "elf32-i386.h"
	#include "elf32-target.h"

- I created an elf32-i386qnx.c that is the same as 
  the above, but which extends the backend before the
  last include:
	#include "elf32-i386.h"
	// do QNX specific extensions
	#include "elf32-target.h"



Is this an ok approach to take?  The only other thing I could 
think of was to change elf32-i386.c:

	#ifndef ELF_BACKEND_INCLUDING_ELF32_I386_C
	#include "elf32-target.h"
	#endif

And then in elf32-i386qnx.c:

	#define ELF_BACKEND_INCLUDING_ELF32_I386_C
	#include elf32-i386.c
	// do QNX specific extensions
	#include "elf32-target.h"

This would result in a smaller diff, one less new file, but
it is ugly.

Thanks.
GP



More information about the Binutils mailing list