On Fri, Nov 27, 2009 at 08:51:41AM +0000, Bjoern A. Zeeb wrote:
> On Tue, 24 Nov 2009, Navdeep Parhar wrote:
> 
> Hi,
> 
> >objdump -h shows that most, but not all, KLDs on amd64 have a "set_pcpu"
> >section of size 0.  Why?  What is the difference between having a 0
> >sized set_pcpu vs. not having it at all?
> >
> >The kernel linker considers the alignment requirements of these empty
> >sections and advances mapsize/mapbase.  This bothers my kgdb (which is
> >slightly modified to deal with amd64 KLDs).
> 
> So what's your real problem?
> 

I'm trying to read a KLD's globals etc. from its .bss and .data from
within kgdb.  It has a problem on amd64 that was discussed a long time
back:
http://lists.freebsd.org/pipermail/freebsd-hackers/2008-September/026014.html

The workaround I was using failed after the appearance of set_pcpu, and
that made me look at the object file and the kernel linker code.  I
think there are two minor problems:

a) There is an empty set_pcpu in the KLD when it shouldn't be there.

b) The kernel linker doesn't ignore this section even though it's empty.
It ends up advancing its location calculations because of the way it
considers alignment requirements, even for empty sections.

> 
> >I'm using the patch shown here as a stopgap measure.  I think the correct
> >fix is to not have these empty sections in the KLD to begin with.
> 
> Right.  The problem here is a bug with ld and linker sets and size and
> aligment calculations the the elf section is started when not all of
> this is known correctly and it's not fixed later.  This came up with
> that "netisr" bug where we had seen the misalignment of the dpcpu set.

Yes, I remember that bug, and some of the changes that went in to fix
it.

Do you know why this empty set_pcpu shows up in most, but not all KLDs?
I was hoping we could remove it from all the ones that don't really have
any PCPU data.

Regards,
Navdeep
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to