On 2010-06-23, JMGross <[email protected]> wrote:
>>>> Second, it's '--gc-sections' not '-gc-sections'
>>> I tried both :)
>
>>And both would have produced an error/warning using your posted
>>makefile, which should have prompted you to try figure out what you
>>were doing wrong rather than claiming the feature didn't work:
>
> I never got one. In theory, my frontend should capture stdout and
> stderr. And normally I see any output from compiler and/or linker. So
> I never thought that I was missing the -Wl prefix.
That's bizarre.
> I just tried agian with intentionally requesting an error message,
> yet there was none. Then I tried to call make from the windows 'DOS'
> console. Still no error message. Is it possible that it is pushed
> into an output streamthat is swallowed by the windows environment?
I don't know. I've never used mspgcc under Windows/DOS. But, IIRC
there's a common mechanism that is used by the compiler to issue all of
the warning/error messages, so I don't see how some messages could get
swallowed while others aren't.
> let me rearrange the statement:
>
> I don't understand why the -gc-sections flag is needed to activate a
> functionality I consider the default behaviour of a linker.
I've been doing embedded development for 25+ years and I don't ever
remember seeing a linker where that was the default behavior.
> Maybe that is why my predecessor put all object files into a library
> and linked it, so unreferenced object files didn't get linked, while
> introducing that maybe even (later) referenced code wasn't linked.
Yes, that's why libraries were invented: because linkers didn't
discard unused object files.
>>> Since 1) is the default, binary files may be unnecessary large by
>>> default.
>
>> Yes.
>
> And that's what I don't understand: why is the special case (keep it
> even if not referenced and therefore unreachable) is the default and
> the default case (keep only what's used) requires extra treatment.
The default case for gnu binutils "ld" and every other linker I've
ever used is to keep all the object files you tell it to link
regardless of whether they are referenced or not.
--
Grant Edwards grant.b.edwards Yow! I once decorated my
at apartment entirely in ten
gmail.com foot salad forks!!