This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Section garbage collection problem


Denys Vlasenko <vda.linux@googlemail.com> writes:
> 
> Otherwise, ld will discard .smp_locks sections, because
> there is no references to them from anywhere.

Actually there should be a reference to it in the start/end labels
which are referenced by the patching code.

Unfortunately they are currently outside the section. All you need
to do is to move them inside.

e.g. 

 __smp_locks = .;
  .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
        *(.smp_locks)
  }
  __smp_locks_end = .;


to (untested)

  .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
 __smp_locks = .;
        *(.smp_locks)
  __smp_locks_end = .;
  }



The only exception are modules; but you can't do the section
GC there anyways.

The bigger problem is telling ld that it can drop smp_locks
snippets which only points to otherwise unused functions. Don't know
of a solution for that. But if it's not done then any function
with any such section refering to it couldn't be discarded.

-Andi


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