On Tue, Aug 14, 2018 at 10:18 PM Mike Stump <mikest...@comcast.net> wrote: > > On Aug 14, 2018, at 4:20 AM, Iain Sandoe <i...@sandoe.co.uk> wrote: > > When function sub-sections are enabled, Darwin’s assembler needs the FDE > > local start > > label for each sub-section to follow a linker-visible one so that the FDE > > will be correctly > > associated with the code of the subsection. > > > > The current code in final.c emits a linker-visible symbol, as needed by > > several targets. > > However the local label used to define the FDE start precedes the > > linker-visible one > > which, for Darwin causes it (the FDE start) to be associated with the > > previous linker- > > visible symbol (or the section start if there isn’t one). This applies > > regardless of the > > actual address of the label, for toolchain assemblers that have strict > > interpretation of > > the Darwin sub-sections-via-symbols ABI. > > > > The patch adds a new local label (analogous to the "LFBn” emitted for the > > regular > > function starts) just after the linker-visible label emitted after > > switching text section. > > The FDE second entry is made to point to this instead of the LcoldStartn > > one. This > > should be a no-op for targets using .cfi_ and for targets without > > sub-sections-via-symbols. > > > > Bootstrapped on x86_64 and i686 linux and on a number of Darwin platforms > > (from > > i686-darwin9 to x86_64-darwin17). > > > > OK for trunk? > > open branches? (although it's a regression on 8, it’s a latent wrong-code > > on all branches) > > I'm fine with the darwin aspects of it, but I think it needs review/approval > by final.c/dwarf people.
The approach looks fine (though we have extra labels even for targets that do not need it). But, + fde->dw_fde_second_begin = xstrdup (label); to me it looks like dw_fde_node is GC allocated so the above needs ggc_strdup. Richard.