Q:gcc function underscores

Q:gcc function underscores

Post by fydd.. » Mon, 21 Jun 1999 04:00:00



Hi,

Is there a way to remove the spurious underscores from the compiled
version of a c program? ie sub_program -> sub_program__ or func ->
func_ so there's no name change in the compiled routine.

Specifically I'm trying to link routines compiled under gcc and g77.
There's a command line option to remove the underscores from g77
compiled functions, now I just need the equivalent under gcc.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

1. How to get rid of leading underscores in gcc 2.7.x

Hi,

I'm working on a simulation program which consists of many .c as well
as .s files. The program run under Intel Pentium with linux OS.

When I tried to link the code I got a lot of link
error saying "undefined reference". I contected with the original
author and he said the program assumes that the object codes
generated by gcc will NOT have a leading underscore for each identifier.
and he told me that gcc 2.7.x can do this.

I was using gcc 2.6.x which generates the leading underscores. I then
grabed the source of the gcc 2.7.2, and compiled it. However the new
compiler still generates the underscores. I even hacked the Makefile.in
file, change the following linesi to generate a "underscore.c" file with
the content as "int prepends_underscore = 0", but the result is same.


stamp-under: $(GCC_PASSES)
        echo "int xxy_us_dummy;" >tmp-dum.c
        $(GCC_FOR_TARGET) -S tmp-dum.c
        echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
        if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
          echo "int prepends_underscore = 0;" >>tmp-under.c; \
        else \
          echo "int prepends_underscore = 0;" >>tmp-under.c; \
        fi
        $(srcdir)/move-if-change tmp-under.c underscore.c
        -rm -f tmp-dum.c tmp-dum.s
        touch stamp-under

Can anyone help me on this? Thanks a lot.

-yiming

--
+-------------------------  Yiming Hu  -----------------------------------+
| Address: Department of Electrical and Computer Engineering              |
|          University of Rhode Island                                     |
|          Kingston, RI 02881, USA                                        |
| Office:  A-218 Kelley Annex                                             |
| Phone:   (401)874-5850                        Fax:     (401)782-6422    |

+-------------------------------------------------------------------------+

2. Slow speed conection with cable modem

3. gcc not generating underscores

4. Password lifetime

5. function, function...who's got the function?

6. Saving registers during context switch

7. Looking for info on GNU GCC G++ functions

8. HELP!! Post.Office/DNS problem

9. GCC math functions not found

10. Problem with gcc's function call ioctl

11. C99 functions on Solaris 8 with gcc

12. Gcc Library functions

13. Help: C-function `uselib', gcc -fPIC