Subject: bug#9927: 24.0.90; unexec/unexmacosx fails with GCC 4.6.1

From: Samuel Bronson <[email-masked]>
Date: Sat, 30 Jun 2012 12:47:59 -0400

Samuel Bronson <[email-masked]> wrote:

> I suppose, though, that if we could be sure that we aren't linking in  
> any static libraries with these *new* BSS sections which will have  
> trouble because of Emacs' dumping them, we could just skip that part;  
> then all we'd need to do is make sure that my_endbss_static refers to  
> an address in __DATA.__bss, not __DATA.__bss1 or __DATA.bss2 like it  
> would naturally end up at on GCC 4.6 or 4.7 (respectively).  (And make  
> unexmacosx.c dump these new BSS sections, of course.)

Well, after my GCC 4.7 build finished, I had a go at building Emacs with 
it and (after getting distracted for a bit playing with the 
--enable-gcc-warnings flag) I got temacs to build and link.  (There was 
some awkwardness involving the -fobjc-exceptions flag that we'll need to 
straighten out...)

I decided I might as well try the simplest thing that could possibly 
work: just dump __DATA.__static_data in the usual way, and dump these 
new BSS sections like __DATA.__bss, only in their entirety rather than 
messing about with markers.

When my first try ended in SIGSEGV, I ran "gobjdump --all" on temacs and 
didn't see any evidence of staticly-linked libraries besides libgcc and 
gnulib; then I noticed that I hadn't looked closely enough at the code 
I'd copied and pasted into my new "else if" clause and rewrote it to 
ACTUALLY work like that for __DATA.__bss without the marker stuff, and 
then I actually got an Emacs.app that worked!

You can see my changes at:
http://bazaar.launchpad.net/~naesten/emacs/nextstep-stuff/revision/108754

Be warned that the line numbers will probably be way off of emacs trunk 
right now, since an earlier commit on my branch deletes largish swathes 
of code that wasn't really doing anything useful.