Cross gcc Mailing List Archive

[Prev][Next][Index][Thread]

Re: ident problems using gnu tools




leisner@sdsp.mc.xerox.com said:
> I suppose it would be relatively straightforward to add an ident 
> extension to gcc...then have a -fuse-ident? 

gcc already supports #ident. Whether the ident strings find their way
into your object code depends on the target description for your platform.
For example, the configuration for i960 (gcc-2.7.2/config/i960/i960.h)
has in it:

	/* Output text for an #ident directive.  */
	#define ASM_OUTPUT_IDENT(FILE, STR)  fprintf(FILE, "\t# %s\n", STR);

Which causes the ident string to be written into the assembly as an
assembler comment.

The GNU assembler supports the .ident pseudo-op so I could for example
change the above to be:

   /* Output text for an #ident directive.  */
   #define ASM_OUTPUT_IDENT(FILE, STR)  fprintf(FILE, "\t.ident \"%s\"\n", 
STR);

et voilá it should work. If the target is an assembler without .ident,
you can divine whatever magic is necessary to get the string deposited
into the object file. With coff targets, .ident puts those strings in
a .comment section. The linker combines those for you.

#ident is not ANSI, granted, but I like it.

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."



References:

Home | Subject Index | Thread Index