This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ECOS] raw output to serial port and dataflash + legacy API questions

> > If something is not referenced, the linker will throw it away. It is
> > unwanted bloat.
> > 
> The variable that is not referenced is marked as __attribute__((used)).

I _think_ this just stops the warning. The symbol itself is not
changed. This attribute is most often used for parameters passed to a
function where for backward compatibility etc, you don't reference one
of the parameters passed in.

> So compiler doesn't inform linker that there is no need to throw it
> away?

I don't think so.

> And as you see, actually I not add reference to variable in
> workaround, I add function to which add reference.
> So reference count to flash driver descriptions hasn't changed,
> but linker do not remove it.

This might suggest you are not using --function-sections and
--data-sections. Using these options the compiler puts each function
and variable into its own section and so allows the linker to do finer
grain garbage discard. Without these options it can only throw away
complete files when all symbols in a file are not used. With these
options it can throw away individual unused functions and variables.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]