Question @ 10,000 feet

Alexander Haley ahaley at alum.wpi.edu
Mon Nov 17 12:47:00 PST 2008


I'm having a hard time conceptualizing how the tool chain becomes
broken during an upgrade (of any piece of the tool chain) ... so I
wonder if I might write my 10,000 foot big picture view of 'how this
all works' and you folks can contribute to my understanding ...

So; To begin with, we've got something called 'code' and code is the
fun stuff we all write ... stuff like printf("Hello World\n");

Now, code is kinda inert ... until we toss it into a compiler's icy
grasp .. and the compiler (gcc) translates the printf("Hello
World\n"); into a machine language suitable for the underlying machine
to actually execute ...

However - certain functions, like printf, are consider so central to
the underpinnings of a system they are grouped into a major-toolkit of
functions ... this is glibc. glibc on its own provides that magical
black box of functionality, libc.so.6 ...

So, our hello world doesn't exactly contain the machine language to
burp the infamous message onto the screen .. rather it has that
message encoded as data, and a call to a standardized function for
printing to a screen ... that function isn't contained inside the
hello world program's binary executable, it is in libc.so.6

So .. when I say, "Run hello world", enter binutils. Binutils
understand that common functionality is often packaged into shared
objects (.so) - aka libraries. Bin utils uses a dynamic linker .. to
ask itself "Hrrm .. they're running hello world .. and it looks like
that references libc stuff .. so I'll load libc into memory, and via
some dark magic, cause the program to be able to call this function
called printf"


Now --- Please go gentle on this description ... I'm shooting for the
'programmers view from the moon of coding on Earth'. Although I
consider myself a non-noobie linux user, and I am a programmer at my
day job ... the mysterious underbelly of "how it all works" is still
new to me .. and I'm excited to be learning about it.

So, please receive these questions as an eager student's desire for learning.

Thank you in advance,
Alexander Haley



More information about the lfs-support mailing list