https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115014
--- Comment #4 from Martin Doucha <mdoucha at suse dot cz> --- (In reply to Andrew Pinski from comment #3) > I think most embedded targets use a flat memory system even on x86_64. I > really think you are barking up the wrong tree on getting this implemented > in GCC (or even LLVM) because of the complexity of tracking the memory. x86_64 targets have no choice about using flat memory because segment limits are ignored by hardware in long mode. This issue is 32bit only. > It is not just about adding ds for ebp accesses. As far as I can tell, EBP and ESP are the only registers that default to stack segment. What else would be needed? > Maybe the easiest fix is to use -fno-omit-frame-pointer to force always the > use of EBP as stack accesses only. That's the first thing I've tried and it didn't help. I had to use -ffixed-ebp as a workaround but that results in a worse performance penalty than prefixes.