I'm sorry for the long text following. The problem is ultimately pretty simple and I'm happy to solve this however seems best, or to leave it to you, kib. This is the last patch of about 10 to get amd64-gcc buildkernel working again.
The extern struct pcpu __pcpu[]; in sys/amd64/include/counter.h is now visible in sys/amd64/amd64/pmap.c via the include in sys/sys/vmmeter.h (new with the counter changes in r317061). pmap.c has its own extern struct pcpu __pcpu[]; declaration. gcc detects this and issues a warning because we use -Wredundant-decls.
Three solutions occur to me.
- Simple one-line hack, delete the pmap.c extern decl. Nice and easy, but unfortunately this codifies reliance on pollution from counter.h, which feels weird.
- Declare extern struct pcpu __pcpu[]; in sys/*/include/pcpu.h, delete all other extern declarations. This solves the problem but exposes the symbol even more widely than now with counter.h.
- Create new headers at sys/*/include/_pcpu.h (?) and put the declaration there. Replace all other extern declarations with an inclusion of _pcpu.h. This avoids making the namespace pollution any worse than with counter.h, but it seems like a pretty heavyweight solution for a single decl.
- Something else?
The attached patch implements option 1.