[TriLUG] what do crt[1in].o do?
Joseph Mack NA3T
jmack at wm7d.net
Wed Dec 9 19:20:50 EST 2009
On Wed, 9 Dec 2009, Rodney Radford wrote:
>
>
>> I tried strace on the executable that didn't run in my first
>> posting and all it gave was "execv: cannot find file"
>
> Yes, I was suggesting you run it on one that did compile
> properly.
doh. I don't often run strace on programs that work.
> However, I do not think that teaching them the internals
> of the GCC compiler is very helpful, any more so than
> teaching the internals of the internal combustion engine
> to a kid wanting to learn how to drive.
We've had the class learning to drive - that was with
python.
The C class has turned out to be about how the engine works.
I assumed I would have been at structs by now. However I
keep getting questions (like "why is the executable bigger
than the object file and what's all this extra stuff we see
with nm?" - that was originally their question not mine - I
expected them to ignore the differences). It turns out that
the class is most interested in how the engine works (which
I'm very happy about). So that's what we're doing.
I showed them the man pages the other night, telling them
that /usr/man/man1 has the man pages for user applications.
I expected that would be it and I could go on, but they next
wanted to know what was in man2..n. So we looked at the wiki
entry explaining the man page sections. I had to explain
what that each section was about, and then explain a sample
of the man pages in each section (eg what is rootflags
about?). Before long we were into daemons, so I explained
client-server. So they wanted to know how a client finds the
server. Then we were into routing, and I explained dotted
quads and netmasks and how IP addresses were assigned and
then DNS and domain registrars. I then showed them
traceroute to google, where you find that the first 4 steps
are inside the ISP (routers addresses resolve to ISP's
names) and the next 3 steps were backbone routers (no
names). All because I told them that /usr/man/man1 contained
man pages for user applications. Sometimes I don't use any
of the material I spend all weekend preparing.
> The same is true of GCC - very few people need to know how
> it works internally.
oh come on now. Everyone needs to know how gcc works :-)
> In fact, I doubt that most graduating computer science
> majors can even explain what happens internally for GCC,
> and they don't care.
I don't know what they know or are supposed to know or care
about, but I'm sorry to hear this. They've had the joy of
learning beaten out of them by years of meaningless teaching
and contrived exams.
> And even if they did care, it varies with different
> compilers and different architectures.
The kids need to know how gcc works to write for embedded
devices. How are they going to write code for the next
wrt54gs if I don't tell them about crt*.o?
> Concentrate on teaching them how to write good C and there
> are several good resources out there for that.
yes this is the major goal no matter what slant you take on
the matter.
> Good luck and I will be glad to help you in your quest for
> internal details of GCC (which is a different subject than
> how to program in C).
Thanks
I'm sure this isn't my last posting on the topic. I haven't
read the pages on gccinit yet, but I hope it steps me
through the crt[1in].o code. It's not like it's really long.
Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!
More information about the TriLUG
mailing list