[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9198.0. "default entry point address core dumps" by ATYISA::ABULIUS () Mon Mar 17 1997 04:10

Hello,
I want to set the default entry point address for my output file to be that of
the symbol epsym. So i created a small routine "epsym()" doing a "printf".
This routine calls main. I used "-e epsym" (ld) when building the output file.
When "printf" is called, the program cores dump - "Segmentation fault (core
dumped)".
Any idea how to use "-e epsym" option.

Thanks Mugur

PS: I used successfully initialization routines (starting with __init_), but
    the customer (Alcatel) wants "-e epsym".
T.RTitleUserPersonal
Name
DateLines
9198.1Here's how I'd do it:QUARRY::reevesJon Reeves, UNIX compiler groupMon Mar 17 1997 13:2710
main() {
	epsym();
}

Seriously, if you must do this, then you also need to do all the environment
setup stuff that crt0.o does for you when you use main().  That's the real
start point of your program, not main, and if those things don't happen,
then main will probably fail miserably.

And no, I won't help you figure out what those things are.
9198.2QUARRY::nethCraig NethMon Mar 17 1997 15:0020
To add a little to John's reply:

As he says, there's a fair amount of initialization that occurs in crt0.o.
The most important is the establishment of the gp pointer - without that,
you can't address any global symbols.   I think it would be difficult to
write a C routine that could do the things you need to do - it would likely
have to be written in assembly.   So even if they made this work, it would
not be any more portable than some other solution.

crt0.o is essentially part of libc.  If you don't plan to use crt0.o then you 
can't reliably use libc either.    

The -e option on the linker is not really intended for use in linking images
that are intended to be run in the DIGITAL UNIX environment - it's a special 
option that is most often used for linking ROM images and imbedded systems 
type stuff - i.e. images that will not be using the DIGITAL UNIX libc and
other libraries.

Perhaps if you explained more _why_ the customer must use this option 
we can help more.
9198.3You're pulling out the foundation!WTFN::SCALESDespair is appropriate and inevitable.Mon Mar 17 1997 17:437
.2> If you don't plan to use crt0.o then you can't reliably use libc either.    

And you can't use some of the performance analysis/profiling tools, and there
are libraries other than libc who rely on crt0.o, as well...


				Webb