tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] TCC built using NOSTDLIB crashes on linux


From: Rob Landley
Subject: Re: [Tinycc-devel] TCC built using NOSTDLIB crashes on linux
Date: Fri, 1 Feb 2008 23:41:06 -0600
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)

On Friday 01 February 2008 22:23:54 KHMan wrote:

> > Did you try building a "hello world" program with that command line, to
> > see if _that_ segfaults?
>
> I tried that on Ubuntu 6.10. Just "./tcc" alone core dumps; if
> he's asking about why "./tcc qwert" failed, I'd question whether
> he has done any homework himself. So if Mike wants to play with
> non-standard link options, he'd better be prepared to conduct some
> investigation of his own.

Yes.  Building a "hello world" program the way he tried to build tcc would be 
that investigation.  I.E.

  $  gcc -nostdlib hello.c /usr/lib/crt1.o /usr/lib/crti.o -ldl -lc -lgcc
  $  ./a.out
  Segmentation fault (core dumped)

If you instead do "gcc -v hello.c" you get:

/usr/lib/gcc/x86_64-linux-gnu/4.1.3/collect2 --eh-frame-hdr
  -m elf_x86_64 --hash-style=both -dynamic-linker
  /lib64/ld-linux-x86-64.so.2
  /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crt1.o
  /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crti.o
  /usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtbegin.o
  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.3
  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.3
  -L/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib
  -L/lib/../lib -L/usr/lib/../lib /tmp/cco0k602.o
  -lgcc --as-needed -lgcc_s --no-as-needed -lc
  -lgcc --as-needed -lgcc_s --no-as-needed
  /usr/lib/gcc/x86_64-linux-gnu/4.1.3/crtend.o
  /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib/crtn.o

From that list it's looking like he forgot crtbegin.o, crtend.o, and crtn.o.

And in fact just adding /usr/lib/crtn.o to his list makes "hello world" work 
for me here.  (With gcc.)

> Perhaps he needs to write a test case 
> for *gcc* that works with the -nostdlib thingy and exercises the
> bunch of symbols tcc needs, before attempting the same trick on
> the whole kaboodle.

Or he could stop asking questions from a group of people who aren't interested 
in answering them, and find people who actually are interested in helping 
those who know less than they do (on _this_ topic, anyway).

> My first posting was mainly out of concern; enthusiasts should not
> be routinely asking for the very limited resources of tcc
> developers or the list to chase down these things -- it is not a
> real good use of their time.

*shrug*  I ask stupid questions all the time.  It's how I learn stuff.  I 
really can't hold it against other people that they do.  (I can be too busy 
to answer, but this is actually something I make time for.)

> On the Mingw list, there was two 
> cases in two weeks where somebody treated the list like tech
> support, and in a demanding and somewhat belligerent manner. Us
> old-timers gawk mutely and wonder in awe at such audacious
> jaw-dropping behaviour. :-)

Was this that guy?  Or are you blaming him for someone else being rude?

A couple weeks ago I had a long email exchange with the maintainer of 
http://www.profv.de/mingw_cross_env/ because I couldn't get it to work.  The 
email exchange went on for two weeks, during which I never did get his cross 
compile environment to work but instead I managed to learn enough to get 
mingw installed under wine, so I have a windows native development 
environment I can use to build win32 binaries under an emulator, and can thus 
now test the tinycc win32 output and win32 host modes over in my version.  (I 
haven't done so yet because I've been busy with other things, but I know how 
now because he helped me despite my initial questions being deeply newbie 
stuff: I don't do windows and know very little about programming for it.  I 
vaguely remember DOS circa 1993, but haven't touched it since.  It turns out 
that basic questions like "Where is the windows equivalent of libc?" contain 
bad built-in assumptions that don't apply to windows, where executable is 
basically statically linked as far as system libraries go, although you need 
about 5 .a libraries in order to perform the static linking.)

If he'd treated me like you treated that guy, I probably would have just 
ripped windows support out of my version entirely, and moved on.

Anyway, off to do other things...

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]