new -fleading-underscore option

Richard Henderson rth@cygnus.com
Tue Oct 27 01:15:00 GMT 1998


Quite a long time ago a Cygnus customer, trying to link legacy assembly
code with new C code, requested an option to be able to force a match
up between different underscore conventions. 

This is me not wanting to maintain this as a separate patch set any longer. 

What this does is to add an option -fleading-underscore, and its
counterpart -fno-leading-underscore, which do the obvious thing to
the symbols defined and referenced by the object file.  Note that
this option should be avoided if possible, and if you do use it,
you better know what you are doing.

I stole some bits from one of Zach's recent cpplib patches to put
all the cpplib bits in a library.  In order to get things to link
properly, I also had to have libcpp.a last in the link order.
After toplev.o was the important bit, last (or nearly so) was easy.

Jim, this patch is slightly different from what you've seen before. 
I ran into new problems linking jc1, f771, and chill when having
defined --enable-c-cpplib.


r~

	* Makefile.in (cc1): Put C_OBJS, and thence @extra_c_objs@ last.
	(LIBCPP_OBJS): New.  Add cppulp.o.
	(cppmain, fix-header): Depend on and use libcpp.a.
	* configure.in (extra_c_objs, extra_cxx_objs): Use libcpp.a instead
	of the individual object files.

	* cccp.c (user_label_prefix): New.
	(main): Set it off -f*leading-underscore.
	(special_symbol): Use it.
	* cpplib.c (special_symbol): Likewise.
	(cpp_handle_option): Handle -f*leading-underscore.
	* cppulp.c: New file.

	* output.h (user_label_prefix): Declare it.
	* dwarf2out.c (ASM_NAME_TO_STRING): Prepend user_label_prefix.
	* toplev.c (f_options, main): Handle -f*leading-underscore.

	* defaults.h (ASM_OUTPUT_LABELREF): Use asm_fprintf instead of
	referencing USER_LABEL_PREFIX directly.
	* config/nextstep.h (ASM_OUTPUT_LABELREF): Likewise.
	* m32r/m32r.h (ASM_OUTPUT_LABELREF): Likewise.
	* final.c (asm_fprintf): Use user_label_prefix instead.
	* arm/thumb.c (thumb_print_operand): Likewise.

	* gcc.c (default_compilers): Pass -f*leading-underscore on to
	cpp wherever appropriate.

cp/
	* Makefile.in (cc1plus): Put CXX_OBJS, and thence @extra_cxx_objs@,
	last.

objc/
	* Make-lang.in (cc1obj): Put OBJC_OBJS, and thence @extra_c_objs@,
	last.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: d-underscore.gz
Type: application/x-gzip
Size: 12549 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/19981027/ea4c4fc9/attachment.bin>


More information about the Gcc-patches mailing list