This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
new -fleading-underscore option
- To: egcs-patches at cygnus dot com, wilson at cygnus dot com
- Subject: new -fleading-underscore option
- From: Richard Henderson <rth at cygnus dot com>
- Date: Mon, 26 Oct 1998 21:24:01 -0800
- Reply-To: Richard Henderson <rth at cygnus dot com>
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.
d-underscore.gz