diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index b9dd6c14809..ee94ad09fd9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -6772,7 +6772,7 @@ DWARF trampolines marked via DW_AT_trampoline are supported by this.
 When issuing a @code{backtrace}, if @code{skip-trampoline-functions} is set,
 @value{GDBN} will skip trampoline frames while printing the stack.
 
-When issuing a @code{finish} or @code{reverse-finish}, if
+When issuing a @code{finish}, @code{reverse-finish} or @code{up}, if
 @code{skip-trampoline-functions} is set, @value{GDBN} will skip trampoline
 frames while returning from the target function.
 
diff --git a/gdb/stack.c b/gdb/stack.c
index fa217ae9f6f..8b1644ddb6e 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2636,6 +2636,13 @@ up_silently_base (const char *count_exp)
   frame = find_relative_frame (get_selected_frame ("No stack."), &count);
   if (count != 0 && count_exp == NULL)
     error (_("Initial frame selected; you cannot go up."));
+
+  if (skip_trampoline_functions)
+    {
+      for (int i = 0; (SAFE_TRAMPOLINE_CHAIN (i, frame)
+		       && in_trampoline_frame (frame)); ++i)
+	frame = get_prev_frame (frame);
+    }
   select_frame (frame);
 }
 
diff --git a/gdb/testsuite/gdb.fortran/func-trampoline.exp b/gdb/testsuite/gdb.fortran/func-trampoline.exp
index f330ac54ef2..ce9f14160aa 100644
--- a/gdb/testsuite/gdb.fortran/func-trampoline.exp
+++ b/gdb/testsuite/gdb.fortran/func-trampoline.exp
@@ -13,8 +13,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/> .
 
-# Test "backtrace", "backtrace -n" and "finish"  commands for functions with
-# trampoline calls.
+# Test "backtrace", "backtrace -n", "finish" and "up"  commands for
+# functions with trampoline calls.
 
 require allow_fortran_tests
 
@@ -97,4 +97,12 @@ foreach_with_prefix opt_level {O0 O2} {
 	    "${fill}first \\(num1=16, num2=3\\)${fill}" \
 	    "${fill}(\r\nValue returned is $valnum_re = 180)"]
     }
+
+    with_test_prefix "up" {
+	init_test $opt_level
+
+	gdb_test "up" [multi_line \
+	    "#$decimal.* $middle_desc" \
+	    "${fill}first = second \\(num1 \\+ 4, num2 \\* 3\\).*${fill}"]
+    }
 }
