News for hackers. Stuff that matters.
Re:Why people were enthused about GCC early on in its life by unwind on Monday February 02, 2015 @10:25AM (#8984575)
Maybe I'm weird, but I'm still enthused about GCC.

I mean come on, it's a free high-quality C compiler for almost any platform you can dig up! That's just awesome! C hasn't died or gone away since the 1980s, and being able to compile C for such a wide range of processors and platforms is great, in my opinion.

Re:Why people were enthused about GCC early on in its life by lmm on Monday February 02, 2015 @11:21AM (#8984924)
LLVM seems to be where the interesting action is these days, I think mostly because it's adopted a superior modular design. GCC's technical design was compromised by RMS' desire to keep it tightly coupled for licensing reasons, and in the past few years the pain of that has really started to be fault. Which is somewhat ironic considering how the free software movement started.
Re:Why people were enthused about GCC early on in its life by david-given on Monday February 02, 2015 @05:32PM (#8987487)
Both LLVM and gcc suffer from the problem that they're vast underdocumented code bases with Internal Platform Syndrome and mostly-but-not-quite-finished internal tools which generate undebuggable code. The actual working set of knowledge which you need to do serious work on the compiler, such as porting it to a new backend, mostly exists as tribal knowledge only, and the only way to find this out is to either investigate the source yourself or to try and ask for help on the mailing lists. LLVM's is significantly more helpful than gcc's, because LLVM has more people participating and more momentum behind it, but you're still not guaranteed to get an answer. Actually producing a working backend is an enormous investment of time and effort.

By way of example: I'm interested in the Broadcom Videocore IV processor, also known as the main processor on the Raspberry Pi. I bounced off both gcc and LLVM, and for much the same reason --- after getting the port about 75% complete I ran into blocking issues that I couldn't fix on my own and couldn't get enough assistance on the mailing lists to fix. Which is a shame. (I should point out that prior to that I did do a VC4 backend for the ACK compiler. It generates terrible, terrible but working code.)

I have run into commercial compilers which were easy to port, and generated good code, to boot. Volker Barthelman's vbcc even has a VC4 backend, which produces amazing code, and his compiler is a tiny fraction of the size of either gcc or LLVM! But it's not open source. Maybe one day we'll get a similarly good open source small compiler...

Re:Why people were enthused about GCC early on in its life by voltagex_ on Monday February 02, 2015 @05:56PM (#8987666)
Offtopic: what's a good way to learn about the Videocore processor? I now own a B+ and a Pi 2 so it might be worth my while.
Re:Why people were enthused about GCC early on in its life by david-given on Monday February 02, 2015 @06:14PM (#8987770)
I have absolutely no idea about the processor in the Pi 2, but I got all the specs for the Pi 1 from here:

https://github.com/hermanhermitage/videocoreiv

(It's a beautiful processor. 32 registers, built in DSP, built in vector processing, some really elegant instruction design, dual core, and enough weirdness that writing good code is satisfying without being frustrating. No double precision float, alas, although it's got single precision, and for some bizarre reason there's no adc or sbc instruction which makes 64 bit arithmetic annoying.)

If you're interested in playing with it, you might also like a look at my half-finished pure-VC4-code boot loader here:

https://cowlark.com/piface

Stick it on an SD card, hook up a serial terminal, and it'll boot directly on the VC4 without even starting up the ARM.

Re:Why people were enthused about GCC early on in its life by voltagex_ on Monday February 02, 2015 @06:45PM (#8987919)
Whoa, does that mean there's a chance of replacing the proprietary bootloader on the Pi? It's the most common complaint I see here.
Re:Why people were enthused about GCC early on in its life by david-given on Tuesday February 03, 2015 @04:17AM (#8989482)
You can replace the proprietary bootloader on the SD card. You can't replace the one in the ROM. And while running executables is easy --- just drop a VC4 binary called bootcode.bin onto the root directory of the card and the ROM loader will load and run it --- there's a lot of hardware setup which still needs to be figured out; such as initialising the SDRAM.

I originally wanted to get Prex (a Minix-like microkernel OS with a Unix interface which doesn't need an MMU) running on the VC4, but I need an actual working compiler for that.

Re:Why people were enthused about GCC early on in its life by acqq on Tuesday February 03, 2015 @05:35AM (#8989645)
May I ask you: why programming VC4 (apart from taking over the control of the rest of Raspberry Pi?) It's only 250 MHz? And if you want the new control of the Raspberry Pi, why, as it's so proprietary?
Re:Why people were enthused about GCC early on in its life by nitrogen on Thursday February 05, 2015 @03:28AM (#9002254)
Clock speed is only a very small part of the performance of a chip when comparing across completely different architectures (like VC4 vs. ARM).
Re:Why people were enthused about GCC early on in its life by david-given on Tuesday February 03, 2015 @11:31AM (#8991269)
Because the VC4 is really cool, basically.
Re:Why people were enthused about GCC early on in its life by phire on Tuesday February 03, 2015 @12:37AM (#8989029)
Pi 2 apparently has the exact same GPU/VPU as the Pi 1.

The only thing they changed was the arm cores and the memory subsystem.

Re:Why people were enthused about GCC early on in its life by omega_rythm on Monday February 02, 2015 @12:38PM (#8985413)
Gcc code is arcane: it relies heavily on macros to define some kind of DSL for the compiler backends (check out the .def files), but if you want to contribute seriously you need to learn that DSL and how it works behind the scene somewhat, whereas llvm is C++. That being said, it's an interesting experience to dive into that code.
Re:Why people were enthused about GCC early on in its life by nhaehnle on Monday February 02, 2015 @03:35PM (#8986751)
I give you: https://github.com/llvm-mirror/llvm/blob/master/lib/Target/X...

I agree with you that gcc is much less pleasant than LLVM+Clang, but to say that LLVM is better becauses it uses C++ everywhere is simply incorrect. In fact, using this kind of DSL for backend definitions is good design.

Re:Why people were enthused about GCC early on in its life by david-given on Monday February 02, 2015 @05:37PM (#8987519)
The LLVM DSL engine is really annoying to use, mainly because the pattern matching engine is pretty simple, and it's possible to express patterns in the DSL language which the pattern matching engine is unable to actually match. Until you know where the limits are it's really frustrating; you write a pattern which should work and the compiler blows stack or produces an impenetrable internal error because the pattern matcher has given up or gone into a working loop.

A large part of any LLVM backend is actually custom C++ code for matching and expanding patterns which the pattern matcher either can't or is unwilling to do (e.g. custom backend-specific DAG nodes). I direct you at this file:

https://github.com/llvm-mirror/llvm/blob/master/lib/Target/X...

github will give you a warning before loading it because that single C++ source file is over a megabyte...

Re:Why people were enthused about GCC early on in its life by omega_rythm on Monday February 02, 2015 @06:27PM (#8987844)
I must admit that my knowledge of llvm is very limited. I did make the (perhaps wrong) assumption that it would be easier to understand on that basis alone (well, and the fact that the people writing it know how to code C++ properly, I guess for major projects like Gcc and llvm you may expect well engineered code). I felt that the whole macro business isn't as solid nowadays as what templates could allow in terms of type checking (and perhaps some macros involved for syntactic sugar alone; caveat with the cryptic error messages for errors in templates), hence my previously stated opinion.

Note that I am not complaining about the DSL, just how things are quite difficult to figure out (and untyped macros, as stated above).

Re:Why people were enthused about GCC early on in its life by sillysaurus3 on Monday February 02, 2015 @04:16PM (#8987041)
That looks very readable. Maybe the gripe was that GCC isn't readable? I don't know, I haven't looked at GCC code.
Re:Why people were enthused about GCC early on in its life by astrange on Monday February 02, 2015 @03:42PM (#8986808)
LLVM's target backends are also written in a custom DSL (tblgen). Is that not a good thing?
Re:Why people were enthused about GCC early on in its life by 1amzave on Monday February 02, 2015 @03:18PM (#8986648)
As opposed to LLVM's tblgen?
Re:Why people were enthused about GCC early on in its life by maxlybbert on Monday February 02, 2015 @02:08PM (#8986080)
GCC developers say that things are better now. I really don't know; I haven't checked.

But the simple fact remains that they did intentionally create hard to maintain code and spent several years rejecting patches that would clean up the monstrosity as a defense against people using GCC code in nonfree programs.

It's hard to trust their judgment now.

Re:Why people were enthused about GCC early on in its life by bronson on Monday February 02, 2015 @03:20PM (#8986668)
Things are better, yes, but there's still a long way to go. This LWN article covers one developer's ongoing frustration: https://lwn.net/Articles/629259/
Re:Why people were enthused about GCC early on in its life by maxlybbert on Monday February 02, 2015 @06:02PM (#8987701)
Yes, the efforts to make it hard for nonfree programs to use parts of GCC also make it hard for free programs to use parts of GCC.
Re:Why people were enthused about GCC early on in its life by a3_nm on Tuesday February 03, 2015 @05:12AM (#8989594)
> compromised by RMS' desire to keep it tightly coupled for licensing reasons

It's certainly better to have an intermediate language and a modular design to compile to it and from it, but I thought this was introduced by LLVM and not gcc because (1.) compiler performance mattered more at the time, so it was better to couple everything to save some performance with dirty tricks, and (2.) people just hadn't realized that this was the right design. (The same way that it took time for the relational database abstraction to come around and replace the tendency for each program to use its custom internal database.)

Is there any specific reason to believe that gcc's design was influenced by licensing reasons?

Re:Why people were enthused about GCC early on in its life by lmm on Tuesday February 03, 2015 @08:07AM (#8990081)
Re:Why people were enthused about GCC early on in its life by a3_nm on Saturday February 07, 2015 @06:00AM (#9013651)
OK, I was wrong. Thanks for pointing this out. This is very interesting (and, in my opinion, quite depressing).
Re:Why people were enthused about GCC early on in its life by jordigh on Monday February 02, 2015 @11:13AM (#8984863)
> Maybe I'm weird, but I'm still enthused about GCC.

I'm just as weird as you.

I am hoping to be able to devote some time this year to cross-pollinate with David Malcolm's work to get libgccjit working on GNU Octave:

https://savannah.gnu.org/patch/index.php?8395

Re:Why people were enthused about GCC early on in its life by gerbilly on Monday February 02, 2015 @12:49PM (#8985489)
I'm weird too, and I'd add that I think Autoconf is also awesome.
Re:Why people were enthused about GCC early on in its life by jordigh on Monday February 02, 2015 @01:33PM (#8985800)
I think the idea of autoconf is great (test for features, not for versions). The implementation in m4 is sadness.

It's possible to do autoconf-style checks in other build systems, but not as easily. I don't know why most build systems seem to ignore the wisdom of autoconf.

Re:Why people were enthused about GCC early on in its life by kevin_thibedeau on Monday February 02, 2015 @03:59PM (#8986927)
m4 is actually pretty awesome when fulfilling its original purpose of adding macros to programming languages. Certainly it's not hygienic and is a pain to debug but it can work wonders to bypass language limitations especially when dealing with assembly code.
Re:Why people were enthused about GCC early on in its life by ChuckMcM on Monday February 02, 2015 @07:16PM (#8988064)
It's not that you are weird you just haven't looked too closely at clang :-)

On a more serious note, the whole "I feel <x> about GCC" has a certain challenge about it as GCC isn't a compiler so much as it is a very long story. I think I have pretty much had every emotion you can have with respect to GCC, whether it was admiration for supporting an obscure platform, hatred for a gratuitous interdependency on a library, or respect for a particularly clean compilation. But over its life it has gone in many directions and gone through many theories of how a compiler should be written, and some of those chapters are very dark indeed.

I was also amused that there is a link chain to the 'kissed a girl' email that Bryan Cantrill (CTO of Joyent) wrote back in 1996. Proof that the Internet really really doesn't like sarcasm.

Re:Why people were enthused about GCC early on in its life by tenfingers on Tuesday February 03, 2015 @04:19AM (#8989488)
Another reason to be enthusiastic about GCC is support for OpenMP.