From 95c4b02aaeba67721e262ff3cc618e62453e6edb Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 28 Oct 1998 22:31:06 +0000 Subject: * 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. * objc/Make-lang.in (cc1obj): Put OBJC_OBJS, and thence @extra_c_objs@, last. * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23415 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 31 +++++++++ gcc/Makefile.in | 23 ++++--- gcc/cccp.c | 11 ++- gcc/config/arm/thumb.c | 2 +- gcc/config/m32r/m32r.h | 2 +- gcc/config/nextstep.h | 2 +- gcc/configure | 183 ++++++++++++++++++++++++------------------------- gcc/configure.in | 5 +- gcc/cpplib.c | 14 +++- gcc/cppulp.c | 27 ++++++++ gcc/defaults.h | 3 +- gcc/dwarf2out.c | 17 +++-- gcc/final.c | 4 +- gcc/gcc.c | 6 ++ gcc/invoke.texi | 9 +++ gcc/objc/Make-lang.in | 5 +- gcc/output.h | 3 + gcc/toplev.c | 28 ++++++++ 18 files changed, 250 insertions(+), 125 deletions(-) create mode 100644 gcc/cppulp.c (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0410c8ffa4b..952a8e5713c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,34 @@ +Wed Oct 28 22:27:05 1998 Richard Henderson + + * 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. + * objc/Make-lang.in (cc1obj): Put OBJC_OBJS, and thence @extra_c_objs@, + last. + + * 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. + Wed Oct 28 23:09:25 1998 Robert Lipe * sco5.h (SUBTARGET_SWITCHES): Add documentation for OpenServer- diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 278cffeba3b..62eed7f068a 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -861,8 +861,8 @@ specs: xgcc$(exeext) gcc-cross: xgcc$(exeext) cp xgcc$(exeext) gcc-cross$(exeext) -cc1$(exeext): $(P) $(C_OBJS) $(OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(OBJS) $(LIBS) +cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS) # Copy float.h from its source. gfloat.h: $(FLOAT_H) @@ -1881,11 +1881,15 @@ cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h gansidecl.h \ -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \ -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'` -cppmain$(exeext): cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \ - prefix.o version.o mbchar.o @extra_cpp_objs@ $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \ - mbchar.o @extra_cpp_objs@ \ - cppalloc.o cpperror.o cppexp.o prefix.o version.o $(LIBS) +LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \ + cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@ + +libcpp.a: $(LIBCPP_OBJS) + $(AR) $(ARFLAGS) libcpp.a $(LIBCPP_OBJS) + +cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \ + libcpp.a $(LIBS) cppmain.o: cppmain.c $(CONFIG_H) cpplib.h system.h gansidecl.h @@ -2117,10 +2121,9 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefil rm -rf fixtmp.c fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \ - cpplib.o cpphash.o cppalloc.o cppexp.o prefix.o version.o + libcpp.a $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \ - scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o prefix.o \ - version.o cppexp.o $(HOST_LIBS) + scan-decls.o scan.o libcpp.a $(HOST_LIBS) fix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \ xsys-protos.h $(build_xm_file) system.h cpplib.h cpphash.h diff --git a/gcc/cccp.c b/gcc/cccp.c index fbea643a4af..293317e0e7f 100644 --- a/gcc/cccp.c +++ b/gcc/cccp.c @@ -727,6 +727,8 @@ char * wchar_type = WCHAR_TYPE; #ifndef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "" #endif +char * user_label_prefix = USER_LABEL_PREFIX; +#undef USER_LABEL_PREFIX /* The string value for __REGISTER_PREFIX__ */ @@ -1529,6 +1531,13 @@ main (argc, argv) } break; + case 'f': + if (!strcmp (argv[i], "-fleading-underscore")) + user_label_prefix = "_"; + else if (!strcmp (argv[i], "-fno-leading-underscore")) + user_label_prefix = ""; + break; + case 'M': /* The style of the choices here is a bit mixed. The chosen scheme is a hybrid of keeping all options in one string @@ -4282,7 +4291,7 @@ special_symbol (hp, op) break; case T_USER_LABEL_PREFIX_TYPE: - buf = USER_LABEL_PREFIX; + buf = user_label_prefix; break; case T_REGISTER_PREFIX_TYPE: diff --git a/gcc/config/arm/thumb.c b/gcc/config/arm/thumb.c index bd302a59665..43082bb2d72 100644 --- a/gcc/config/arm/thumb.c +++ b/gcc/config/arm/thumb.c @@ -1732,7 +1732,7 @@ thumb_print_operand (f, x, code) return; case '_': - fputs (USER_LABEL_PREFIX, f); + fputs (user_label_prefix, f); return; case 'D': diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 12a1a50eafa..d825f989346 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1660,7 +1660,7 @@ do { \ do { \ char * real_name; \ STRIP_NAME_ENCODING (real_name, (NAME)); \ - fprintf (FILE, "%s%s", USER_LABEL_PREFIX, real_name); \ + asm_fprintf (FILE, "%U%s", real_name); \ } while (0) /* If -Os, don't force line number labels to begin at the beginning of diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h index a3919f7f023..59050a18a9e 100644 --- a/gcc/config/nextstep.h +++ b/gcc/config/nextstep.h @@ -291,7 +291,7 @@ extern int handle_pragma (); else if (!strncmp (NAME, "_OBJC_", 6)) fprintf (FILE, "L%s", NAME); \ else if (!strncmp (NAME, ".objc_class_name_", 17)) \ fprintf (FILE, "%s", NAME); \ - else fprintf (FILE, "%s%s", USER_LABEL_PREFIX, NAME); } while (0) + else asm_fprintf (FILE, "%U%s", NAME); } while (0) #undef ALIGN_ASM_OP #define ALIGN_ASM_OP ".align" diff --git a/gcc/configure b/gcc/configure index e4aa7fcc936..6acf456afd7 100755 --- a/gcc/configure +++ b/gcc/configure @@ -772,9 +772,8 @@ fi if test "${enable_c_cpplib+set}" = set; then enableval="$enable_c_cpplib" if test x$enable_c_cpplib != xno; then - extra_c_objs="${extra_c_objs} cpplib.o cppexp.o cpphash.o cpperror.o" - extra_c_objs="${extra_c_objs} prefix.o" - extra_cxx_objs="${extra_cxx_objs} ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o ../prefix.o" + extra_c_objs="${extra_c_objs} libcpp.a" + extra_cxx_objs="${extra_cxx_objs} ../libcpp.a" extra_c_flags=-DUSE_CPPLIB=1 cpp_main=cppmain fi @@ -916,7 +915,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:920: checking host system type" >&5 +echo "configure:919: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -937,7 +936,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:941: checking target system type" >&5 +echo "configure:940: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -955,7 +954,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:959: checking build system type" >&5 +echo "configure:958: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -982,7 +981,7 @@ test "$host_alias" != "$target_alias" && # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:986: checking for $ac_word" >&5 +echo "configure:985: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1011,7 +1010,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1015: checking for $ac_word" >&5 +echo "configure:1014: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1061,7 +1060,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1065: checking for $ac_word" >&5 +echo "configure:1064: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1092,7 +1091,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1096: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1095: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1102,11 +1101,11 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1126,12 +1125,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1130: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1129: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1135: checking whether we are using GNU C" >&5 +echo "configure:1134: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1140,7 +1139,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1159,7 +1158,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1163: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1162: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1202,7 +1201,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1206: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1205: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1230,7 +1229,7 @@ fi echo $ac_n "checking whether a default assembler was specified""... $ac_c" 1>&6 -echo "configure:1234: checking whether a default assembler was specified" >&5 +echo "configure:1233: checking whether a default assembler was specified" >&5 if test x"${AS+set}" = x"set"; then if test x"$with_gas" = x"no"; then echo "$ac_t""yes ($AS)" 1>&6 @@ -1242,7 +1241,7 @@ else fi echo $ac_n "checking whether a default linker was specified""... $ac_c" 1>&6 -echo "configure:1246: checking whether a default linker was specified" >&5 +echo "configure:1245: checking whether a default linker was specified" >&5 if test x"${LD+set}" = x"set"; then if test x"$with_gnu_ld" = x"no"; then echo "$ac_t""yes ($LD)" 1>&6 @@ -1259,7 +1258,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1263: checking for $ac_word" >&5 +echo "configure:1262: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1290,7 +1289,7 @@ done # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1294: checking for $ac_word" >&5 +echo "configure:1293: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1323,7 +1322,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1327: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1326: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1331,7 +1330,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1365,7 +1364,7 @@ fi fi echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:1369: checking whether ln works" >&5 +echo "configure:1368: checking whether ln works" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_LN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1397,7 +1396,7 @@ else fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1401: checking whether ln -s works" >&5 +echo "configure:1400: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1429,19 +1428,19 @@ else fi echo $ac_n "checking for volatile""... $ac_c" 1>&6 -echo "configure:1433: checking for volatile" >&5 +echo "configure:1432: checking for volatile" >&5 if eval "test \"`echo '$''{'gcc_cv_c_volatile'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_c_volatile=yes else @@ -1464,7 +1463,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1468: checking for $ac_word" >&5 +echo "configure:1467: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1495,7 +1494,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1499: checking for $ac_word" >&5 +echo "configure:1498: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1535,7 +1534,7 @@ test -n "$YACC" || YACC="yacc" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1539: checking for a BSD compatible install" >&5 +echo "configure:1538: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1586,7 +1585,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1590: checking how to run the C preprocessor" >&5 +echo "configure:1589: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1601,13 +1600,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1618,13 +1617,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1635,13 +1634,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1666,12 +1665,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1670: checking for ANSI C header files" >&5 +echo "configure:1669: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1679,7 +1678,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1683: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1682: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1696,7 +1695,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1714,7 +1713,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1735,7 +1734,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1746,7 +1745,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1770,12 +1769,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1774: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1773: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1784,7 +1783,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1805,12 +1804,12 @@ EOF fi echo $ac_n "checking whether string.h and strings.h may both be included""... $ac_c" 1>&6 -echo "configure:1809: checking whether string.h and strings.h may both be included" >&5 +echo "configure:1808: checking whether string.h and strings.h may both be included" >&5 if eval "test \"`echo '$''{'gcc_cv_header_string'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1818,7 +1817,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_header_string=yes else @@ -1842,17 +1841,17 @@ for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unist do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1846: checking for $ac_hdr" >&5 +echo "configure:1845: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1882,17 +1881,17 @@ done # Check for thread headers. ac_safe=`echo "thread.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for thread.h""... $ac_c" 1>&6 -echo "configure:1886: checking for thread.h" >&5 +echo "configure:1885: checking for thread.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1916,17 +1915,17 @@ fi ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for pthread.h""... $ac_c" 1>&6 -echo "configure:1920: checking for pthread.h" >&5 +echo "configure:1919: checking for pthread.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1953,7 +1952,7 @@ fi # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1957: checking for $ac_word" >&5 +echo "configure:1956: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gnat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1983,12 +1982,12 @@ fi # See if the system preprocessor understands the ANSI C preprocessor # stringification operator. echo $ac_n "checking whether cpp understands the stringify operator""... $ac_c" 1>&6 -echo "configure:1987: checking whether cpp understands the stringify operator" >&5 +echo "configure:1986: checking whether cpp understands the stringify operator" >&5 if eval "test \"`echo '$''{'gcc_cv_c_have_stringify'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_c_have_stringify=yes else @@ -2019,12 +2018,12 @@ fi # Use only if it exists, # doesn't clash with , and declares intmax_t. echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6 -echo "configure:2023: checking for inttypes.h" >&5 +echo "configure:2022: checking for inttypes.h" >&5 if eval "test \"`echo '$''{'gcc_cv_header_inttypes_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2032,7 +2031,7 @@ int main() { intmax_t i = -1; ; return 0; } EOF -if { (eval echo configure:2036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <&6 -echo "configure:2059: checking for $ac_func" >&5 +echo "configure:2058: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2112,12 +2111,12 @@ done #AC_CHECK_TYPE(wchar_t, unsigned int) echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2116: checking for vprintf" >&5 +echo "configure:2115: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -2164,12 +2163,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2168: checking for _doprnt" >&5 +echo "configure:2167: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -2228,7 +2227,7 @@ fi echo $ac_n "checking whether the printf functions support %p""... $ac_c" 1>&6 -echo "configure:2232: checking whether the printf functions support %p" >&5 +echo "configure:2231: checking whether the printf functions support %p" >&5 if eval "test \"`echo '$''{'gcc_cv_func_printf_ptr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2236,7 +2235,7 @@ else gcc_cv_func_printf_ptr=no else cat > conftest.$ac_ext < @@ -2249,7 +2248,7 @@ main() exit (p != q); } EOF -if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gcc_cv_func_printf_ptr=yes else @@ -2278,12 +2277,12 @@ for ac_func in malloc realloc calloc free bcopy bzero bcmp \ strsignal do echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6 -echo "configure:2282: checking whether $ac_func must be declared" >&5 +echo "configure:2281: checking whether $ac_func must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2316,7 +2315,7 @@ int main() { char *(*pfn) = (char *(*)) $ac_func ; return 0; } EOF -if { (eval echo configure:2320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "gcc_cv_decl_needed_$ac_func=no" else @@ -2345,12 +2344,12 @@ done for ac_func in getrlimit setrlimit do echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6 -echo "configure:2349: checking whether $ac_func must be declared" >&5 +echo "configure:2348: checking whether $ac_func must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2387,7 +2386,7 @@ int main() { char *(*pfn) = (char *(*)) $ac_func ; return 0; } EOF -if { (eval echo configure:2391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "gcc_cv_decl_needed_$ac_func=no" else @@ -2414,12 +2413,12 @@ done echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2418: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:2417: checking for sys_siglist declaration in signal.h or unistd.h" >&5 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2431,7 +2430,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:2435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -5644,7 +5643,7 @@ fi # Figure out what assembler alignment features are present. echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:5648: checking assembler alignment features" >&5 +echo "configure:5647: checking assembler alignment features" >&5 gcc_cv_as= gcc_cv_as_alignment_features= gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas @@ -5715,7 +5714,7 @@ fi echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:5719: checking assembler subsection support" >&5 +echo "configure:5718: checking assembler subsection support" >&5 gcc_cv_as_subsections= if test x$gcc_cv_as != x; then # Check if we have .subsection @@ -5951,7 +5950,7 @@ fi # Warn if using init_priority. echo $ac_n "checking whether to enable init_priority by default""... $ac_c" 1>&6 -echo "configure:5955: checking whether to enable init_priority by default" >&5 +echo "configure:5954: checking whether to enable init_priority by default" >&5 if test x$enable_init_priority != xyes; then enable_init_priority=no fi diff --git a/gcc/configure.in b/gcc/configure.in index 5b79d3f3e75..dc3f42c152b 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -190,9 +190,8 @@ AC_ARG_ENABLE(c-cpplib, [ --enable-c-cpplib link cpplib directly into C and C++ compilers (implies --enable-cpplib).], if test x$enable_c_cpplib != xno; then - extra_c_objs="${extra_c_objs} cpplib.o cppexp.o cpphash.o cpperror.o" - extra_c_objs="${extra_c_objs} prefix.o" - extra_cxx_objs="${extra_cxx_objs} ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o ../prefix.o" + extra_c_objs="${extra_c_objs} libcpp.a" + extra_cxx_objs="${extra_cxx_objs} ../libcpp.a" extra_c_flags=-DUSE_CPPLIB=1 cpp_main=cppmain fi) diff --git a/gcc/cpplib.c b/gcc/cpplib.c index b45e014351d..c726c3c813c 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -38,6 +38,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gansidecl.h" #include "cpplib.h" #include "cpphash.h" +#include "output.h" #ifndef GET_ENV_PATH_LIST #define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) @@ -2338,7 +2339,7 @@ special_symbol (hp, pfile) break; case T_USER_LABEL_PREFIX_TYPE: - buf = USER_LABEL_PREFIX; + buf = user_label_prefix; break; case T_REGISTER_PREFIX_TYPE: @@ -6342,6 +6343,10 @@ cpp_handle_option (pfile, argc, argv) { struct cpp_options *opts = CPP_OPTIONS (pfile); int i = 0; + + if (user_label_prefix == NULL) + user_label_prefix = USER_LABEL_PREFIX; + if (argv[i][0] != '-') { if (opts->out_fname != NULL) { @@ -6362,6 +6367,13 @@ cpp_handle_option (pfile, argc, argv) cpp_fatal (pfile, "Directory name missing after `%s' option", argv[i]); return argc; + case 'f': + if (!strcmp (argv[i], "-fleading-underscore")) + user_label_prefix = "_"; + else if (!strcmp (argv[i], "-fno-leading-underscore")) + user_label_prefix = ""; + break; + case 'i': if (!strcmp (argv[i], "-include") || !strcmp (argv[i], "-imacros")) { diff --git a/gcc/cppulp.c b/gcc/cppulp.c new file mode 100644 index 00000000000..29c2551face --- /dev/null +++ b/gcc/cppulp.c @@ -0,0 +1,27 @@ +/* CPP Library. + Copyright (C) 1986, 87, 89, 92-97, 1998 Free Software Foundation, Inc. + Contributed by Per Bothner, 1994-95. + Based on CCCP program by Paul Rubin, June 1986 + Adapted to ANSI C, Richard Stallman, Jan 1987 + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" + +#include "gansidecl.h" +#include "output.h" + +char *user_label_prefix; diff --git a/gcc/defaults.h b/gcc/defaults.h index 434d761afed..a34af76e40c 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -121,8 +121,7 @@ do { fprintf (FILE, "\t%s\t", ASM_LONG); \ /* This is how to output a reference to a user-level label named NAME. */ #ifndef ASM_OUTPUT_LABELREF -#define ASM_OUTPUT_LABELREF(FILE,NAME) \ - do { fputs (USER_LABEL_PREFIX, FILE); fputs (NAME, FILE); } while (0) +#define ASM_OUTPUT_LABELREF(FILE,NAME) asm_fprintf ((FILE), "%U%s", (NAME)) #endif /* This determines whether or not we support weak symbols. */ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2a14670ae0a..86bfec5b099 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2663,13 +2663,16 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES]; macro has the same effect as ASM_OUTPUT_LABELREF, but copies to a string rather than writing to a file. */ #ifndef ASM_NAME_TO_STRING -#define ASM_NAME_TO_STRING(STR, NAME) \ - do { \ - if ((NAME)[0] == '*') \ - dyn_string_append (STR, NAME + 1); \ - else \ - dyn_string_append (STR, NAME); \ - } \ +#define ASM_NAME_TO_STRING(STR, NAME) \ + do { \ + if ((NAME)[0] == '*') \ + dyn_string_append (STR, NAME + 1); \ + else \ + { \ + dyn_string_append (STR, user_label_prefix); \ + dyn_string_append (STR, NAME); \ + } \ + } \ while (0) #endif diff --git a/gcc/final.c b/gcc/final.c index 4f7dd9f6f2b..b750d9394b8 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3831,9 +3831,7 @@ asm_fprintf VPROTO((FILE *file, char *p, ...)) break; case 'U': -#ifdef USER_LABEL_PREFIX - fprintf (file, "%s", USER_LABEL_PREFIX); -#endif + fputs (user_label_prefix, file); break; default: diff --git a/gcc/gcc.c b/gcc/gcc.c index 28322e169fc..a7eb71e45e2 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -628,6 +628,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}\ %{!E:%{!M:%{!MM:cc1 %i %1 \ @@ -661,6 +662,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", "%{!M:%{!MM:%{!E:cc1 %{!pipe:%g.i} %1 \ @@ -686,6 +688,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %W{o*}}\ %{!E:%e-E required when input is from standard input}"}}, @@ -700,6 +703,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \ @@ -725,6 +729,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %W{o*}"}}, {".i", {"@cpp-output"}}, @@ -752,6 +757,7 @@ static struct compiler default_compilers[] = %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ %{traditional} %{ftraditional:-traditional}\ %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", "%{!M:%{!MM:%{!E:%{!S:as %a %Y\ diff --git a/gcc/invoke.texi b/gcc/invoke.texi index 162a1e69a4f..6b041fe38f8 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -408,6 +408,7 @@ in the following sections. -fverbose-asm -fpack-struct -fstack-check -fargument-alias -fargument-noalias -fargument-noalias-global +-fleading-underscore @end smallexample @end table @@ -5989,6 +5990,14 @@ alias each other and do not alias global storage. Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself. + +@item -fleading-underscore +This option and its counterpart, -fno-leading-underscore, forcibly +change the way C symbols are represented in the object file. One use +is to help link with legacy assembly code. + +Be warned that you should know what you are doing when invoking this +option, and that not all targets provide complete support for it. @end table @node Environment Variables diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index bc47fc2e143..2ef888cd6d2 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -59,9 +59,8 @@ OBJECTIVE-C objective-c: cc1obj$(exeext) # Language-specific object files for Objective C. OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS) -cc1obj$(exeext): $(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \ - $(LIBS) +cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(OBJC_OBJS) $(LIBS) # Objective C language specific files. diff --git a/gcc/output.h b/gcc/output.h index 83ec167f298..4082e629cfc 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -482,3 +482,6 @@ extern FILE *rtl_dump_file; && (DECL_INITIAL (DECL) == error_mark_node \ || TREE_CONSTANT (DECL_INITIAL (DECL))) \ && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL)))) + +/* User label prefix in effect for this compilation. */ +extern char *user_label_prefix; diff --git a/gcc/toplev.c b/gcc/toplev.c index 197d2801d78..5acb8f014b2 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -770,6 +770,17 @@ typedef struct } lang_independent_options; +/* Add or remove a leading underscore from user symbols. */ +int flag_leading_underscore = -1; + +/* The user symbol prefix after having resolved same. */ +char *user_label_prefix; + +/* A default for same. */ +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + /* Table of language-independent -f options. STRING is the option name. VARIABLE is the address of the variable. ON_VALUE is the value to store in VARIABLE @@ -915,6 +926,8 @@ lang_independent_options f_options[] = "Suppress output of instruction numbers and line number notes in debugging dumps"}, {"instrument-functions", &flag_instrument_function_entry_exit, 1, "Instrument function entry/exit with profiling calls"}, + {"leading-underscore", &flag_leading_underscore, 1, + "External symbols have a leading underscore" } }; #define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0])) @@ -4899,6 +4912,21 @@ main (argc, argv) warning ("this target machine does not have delayed branches"); #endif + user_label_prefix = USER_LABEL_PREFIX; + if (flag_leading_underscore != -1) + { + /* If the default prefix is more complicated than "" or "_", + issue a warning and ignore this option. */ + if (user_label_prefix[0] == 0 || + (user_label_prefix[0] == '_' && user_label_prefix[1] == 0)) + { + user_label_prefix = flag_leading_underscore ? "_" : ""; + } + else + warning ("-f%sleading-underscore not supported on this target machine", + flag_leading_underscore ? "" : "no-"); + } + /* If we are in verbose mode, write out the version and maybe all the option flags in use. */ if (version_flag) -- cgit v1.2.1