On Sun, Mar 13, 2011 at 11:55:02AM -0700, Chris Lattner wrote: > > On Mar 13, 2011, at 11:26 AM, Jack Howarth wrote: > > >> Yes, I agree that this is a better solution. This error was put into the > >> linker to detect some overflow conditions for part of the code that > >> expected the section number to only be a byte. It is likely that "things > >> worked" only out of luck before. > >> > >> -Chris > > > > Chris, > > Is there any documentation or example code on how to properly use > > subsections in mach-o? > > My fear is that we are moving from one poorly documented technique to > > another which may well > > have it own slate of hidden bugs. > > I'm not sure what you mean here Jack. ld64 is open source on the darwin > page, and if you have all the developer bits installed, the format is > "documented" in /usr/include/mach-o/. It's pretty clear all around that you > can only have 256 sections. > > -Chris
Chris, The mach-o reference has a cryptic mention of MH_SUBSECTIONS_VIA_SYMBOLS in http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html MH_SUBSECTIONS_VIA_SYMBOLS—The sections of the object file can be divided into individual blocks. These blocks are dead-stripped if they are not used by other code. See Linking for details. Although I don't think this helps us at all because none of the GNU_LTO sections contain symbols. This is why I am still perplexed by this assembler change. We followed the rules Nick suggested of placing all of these GNU_LTO sections at the end of the file and none contain symbols. In that case, it would really seem that the assembler is now blindly counting sections without respect to whether any of them actually contain symbols. Jack