[RFA] Coff SEC_LOAD vs SEC_NEVER_LOAD

Ian Lance Taylor ian@airs.com
Fri May 30 17:27:00 GMT 2003


"Svein E. Seldal" <Svein.Seldal@solidas.com> writes:

> Looking in coffcode.h i find this in styp_to_sec_flags():
> 
>     #ifdef STYP_NOLOAD
>       if (styp_flags & STYP_NOLOAD)
>         sec_flags |= SEC_NEVER_LOAD;
>     #endif /* STYP_NOLOAD */
> 
> followed by this:
> 
>     else
>       sec_flags |= SEC_ALLOC | SEC_LOAD;
> 
> Which confirms this obeservation. However, looking at the code, it
> surely seems like this code isnt made this way by accident.

I suspect that it is indeed an accident.  That function has grown
entirely by accretion.

Your proposed patch will break things, as there is code in the
function which explicitly checks for the SEC_NEVER_LOAD flag your
patch no longer sets.

I suspect that last line should just become something like
    else if (sec_flags & SEC_NEVER_LOAD)
      sec_flags |= SEC_ALLOC;
    else
      sec_flags |= SEC_ALLOC | SEC_LOAD;

Ian



More information about the Binutils mailing list