Looks like I have made some typos. My apologies. Seeing above that I passed '--enable-frame-pointer', GCC still does not use the frame pointer. I even went in and enabled the C preprocessor macro, SUBTARGET_FRAME_POINTER_REQUIRED which forces TARGET_FRAME_POINTER_REQUIRED to return TRUE. I didn't use the machine-description macro FRAME_POINTER_REQUIRED. Could that also be it? Where would I set this? Also, I'm recompiling GCC by passing the flag '--without-dwarf2'. In gcc/config/sh.c, there is a boolean checking if the debugging type DWARF-2 is preferred: flag_omit_frame_pointer = (PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG) I'll report back. On Sat, Jun 9, 2012 at 9:04 AM, Israel Jacquez <mrkotfw@xxxxxxxxx> wrote: > Hello everyone, > > Version: GCC 4.3.6 > Target: sh > OS: GNU/Linux > Flags passed to GCC configure: > --enable-frame-pointer > --disable-cld > --disable-initfini-array > --disable-largefile > --disable-libstdcxx-pch > --disable-multilib > --disable-multilib > --disable-nls > --disable-objc-gc > --disable-rpath > --disable-shared > --disable-threads > --disable-tls > --disable-win32-registry > --enable-decimal-float=no > --enable-languages=c,c++ > --enable-static > --program-prefix="sh-elf-" > --target="sh-elf" > --with-gcc > --with-gnu-as > --with-gnu-ld > --with-newlib > > On this architecture, the r14 register is considered to be the frame > pointer register. The "pr" register is the procedure register that > holds the return address. The "JSR" appropriately sets the "pr" > register while "JMP" or any of the branch instructions do not. > > The flags I've used to compile my binaries (no ELF executables): > -O2 -fno-omit-frame-pointer > > Seeing above that I passed '--enable-frame-pointer', GCC still does > not use the frame pointer. I even when in and enabled the C > preprocessor macro, SUBTARGET_FRAME_POINTER_REQUIRED which forces > FRAME_POINTER_REQUIRED to return TRUE. I didn't use the > machine-description macro FRAME_POINTER_REQUIRED. Could that also be > it? Where would I set this? > > The ONLY way it works is if EVERY function has the following > attribute: '__attribute__((optimize("-fno-omit-frame-pointer")))', but > I MUST use the -O2 optimization level or else the frame pointer will > not be used again. > > > Am I missing something important here? I would simply like to have > -fomit-frame-pointer and -fno-frame-pointer work as expected.