aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/elf-bfd.h27
-rw-r--r--bfd/elf32-arc.c12
-rw-r--r--bfd/elf32-i386.c8
-rw-r--r--bfd/elf32-ppc.c9
-rw-r--r--bfd/elf64-ppc.c8
-rw-r--r--bfd/elf64-x86-64.c8
-rw-r--r--bfd/version.h2
-rw-r--r--gdb/doc/gdb.texinfo10
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c18
-rw-r--r--gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S23
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c18
-rw-r--r--gdb/testsuite/gdb.arch/i386-disp-step-self-call.S23
-rw-r--r--gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp69
-rw-r--r--gdb/testsuite/gdb.base/break-dbg.exp12
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp.exp6
-rw-r--r--gprofng/src/Stabs.cc2
-rw-r--r--ld/testsuite/ld-elf/linkonce1.d5
-rw-r--r--ld/testsuite/ld-elf/linkonce3.d13
18 files changed, 154 insertions, 119 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index fbb1cd9..c02e34e 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -3287,25 +3287,20 @@ extern asection _bfd_elf_large_com_section;
&& ((input_section->flags & SEC_DEBUGGING) != 0 \
|| elf_section_type (input_section) == SHT_GNU_SFRAME)) \
{ \
- Elf_Internal_Shdr *rel_hdr; \
+ Elf_Internal_Shdr *rel_hdr \
+ = _bfd_elf_single_rel_hdr (input_section->output_section); \
\
- rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); \
+ rel_hdr->sh_size -= rel_hdr->sh_entsize; \
+ rel_hdr = _bfd_elf_single_rel_hdr (input_section); \
+ rel_hdr->sh_size -= rel_hdr->sh_entsize; \
\
- /* Avoid empty output section. */ \
- if (rel_hdr->sh_size > rel_hdr->sh_entsize) \
- { \
- rel_hdr->sh_size -= rel_hdr->sh_entsize; \
- rel_hdr = _bfd_elf_single_rel_hdr (input_section); \
- rel_hdr->sh_size -= rel_hdr->sh_entsize; \
+ memmove (rel, rel + count, \
+ (relend - rel - count) * sizeof (*rel)); \
\
- memmove (rel, rel + count, \
- (relend - rel - count) * sizeof (*rel)); \
- \
- input_section->reloc_count -= count; \
- relend -= count; \
- rel--; \
- continue; \
- } \
+ input_section->reloc_count -= count; \
+ relend -= count; \
+ rel--; \
+ continue; \
} \
\
for (int i_ = 0; i_ < count; i_++) \
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 0a6e665..a78516d 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -1947,6 +1947,18 @@ elf_arc_relocate_section (bfd * output_bfd,
return false;
}
+ if (wrel != rel)
+ {
+ Elf_Internal_Shdr *rel_hdr;
+ size_t deleted = rel - wrel;
+
+ rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section);
+ rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
+ rel_hdr = _bfd_elf_single_rel_hdr (input_section);
+ rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
+ input_section->reloc_count -= deleted;
+ }
+
return true;
}
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index b417cb0..abe26e4 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3600,14 +3600,6 @@ elf_i386_relocate_section (bfd *output_bfd,
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
- if (rel_hdr->sh_size == 0)
- {
- /* It is too late to remove an empty reloc section. Leave
- one NONE reloc.
- ??? What is wrong with an empty section??? */
- rel_hdr->sh_size = rel_hdr->sh_entsize;
- deleted -= 1;
- }
rel_hdr = _bfd_elf_single_rel_hdr (input_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
input_section->reloc_count -= deleted;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index f17effd..3fd9f28 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -9142,15 +9142,6 @@ ppc_elf_relocate_section (bfd *output_bfd,
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
- if (rel_hdr->sh_size == 0)
- {
- /* It is too late to remove an empty reloc section. Leave
- one NONE reloc.
- ??? What is wrong with an empty section??? */
- rel_hdr->sh_size = rel_hdr->sh_entsize;
- deleted -= 1;
- wrel++;
- }
relend = wrel;
rel_hdr = _bfd_elf_single_rel_hdr (input_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 00c1c32..e6c90a6 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -18082,14 +18082,6 @@ ppc64_elf_relocate_section (bfd *output_bfd,
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
- if (rel_hdr->sh_size == 0)
- {
- /* It is too late to remove an empty reloc section. Leave
- one NONE reloc.
- ??? What is wrong with an empty section??? */
- rel_hdr->sh_size = rel_hdr->sh_entsize;
- deleted -= 1;
- }
rel_hdr = _bfd_elf_single_rel_hdr (input_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
input_section->reloc_count -= deleted;
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index ebd2eb4..b6f97b5 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5099,14 +5099,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
- if (rel_hdr->sh_size == 0)
- {
- /* It is too late to remove an empty reloc section. Leave
- one NONE reloc.
- ??? What is wrong with an empty section??? */
- rel_hdr->sh_size = rel_hdr->sh_entsize;
- deleted -= 1;
- }
rel_hdr = _bfd_elf_single_rel_hdr (input_section);
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted;
input_section->reloc_count -= deleted;
diff --git a/bfd/version.h b/bfd/version.h
index f200fb8..c33770d 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20250718
+#define BFD_VERSION_DATE 20250720
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 35b770f..2bbaf14 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -27659,6 +27659,16 @@ or a prompt that does not.
@item set prompt @var{newprompt}
Directs @value{GDBN} to use @var{newprompt} as its prompt string henceforth.
+For example, this will set a blue-colored ``(gdb)'' prompt:
+
+@smallexample
+set prompt \001\033[0;34m\002(gdb)\001\033[0m\002
+@end smallexample
+
+It uses @samp{\001} and @samp{\002} to begin and end a sequence of
+non-printing characters, to make sure they're not counted in the string
+length.
+
@kindex show prompt
@item show prompt
Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}}
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
index 03b868c..0fb2904 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call-alarm.c
@@ -16,9 +16,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdlib.h>
+
+extern void test_call (void);
+
+void
+unreachable (void)
+{
+ abort ();
+}
void
setup_alarm (void)
{
alarm (300);
}
+
+int
+main ()
+{
+ setup_alarm ();
+ test_call ();
+ unreachable ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
index 78a6859..20a8eb7 100644
--- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
+++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.S
@@ -18,33 +18,12 @@
handling. */
.text
-
- .global main
-main:
- nop
-
- callq setup_alarm
-
- nop
-
-/***********************************************/
-
-/* test call/ret */
-
.global test_call
test_call:
call test_call
- nop
+ call unreachable
.global test_ret_end
test_ret_end:
nop
-/***********************************************/
-
-/* all done */
-
-done:
- mov $0,%rdi
- call exit
- hlt
.section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
index 03b868c..0fb2904 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call-alarm.c
@@ -16,9 +16,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
+#include <stdlib.h>
+
+extern void test_call (void);
+
+void
+unreachable (void)
+{
+ abort ();
+}
void
setup_alarm (void)
{
alarm (300);
}
+
+int
+main ()
+{
+ setup_alarm ();
+ test_call ();
+ unreachable ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
index 466e50c..20a8eb7 100644
--- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
+++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.S
@@ -18,33 +18,12 @@
handling. */
.text
-
- .global main
-main:
- nop
-
- call setup_alarm
-
- nop
-
-/***********************************************/
-
-/* test call/ret */
-
.global test_call
test_call:
call test_call
- nop
+ call unreachable
.global test_ret_end
test_ret_end:
nop
-/***********************************************/
-
-/* all done */
-
-done:
- pushl $0
- call exit
- hlt
.section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
index 53bf642..fce6d67 100644
--- a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
+++ b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp
@@ -31,7 +31,7 @@ proc prepare_test {has_cfi} {
"${objcallerfile}" \
object [list {additional_flags=-fomit-frame-pointer \
-funwind-tables -fasynchronous-unwind-tables}]] != "" } {
- untested "couldn't compile with cfi"
+ untested "couldn't compile"
return false
}
} else {
@@ -41,7 +41,7 @@ proc prepare_test {has_cfi} {
object [list {additional_flags=-fomit-frame-pointer \
-fno-unwind-tables \
-fno-asynchronous-unwind-tables}]] != "" } {
- untested "couldn't compile without cfi"
+ untested "couldn't compile"
return false
}
}
@@ -54,15 +54,12 @@ proc prepare_test {has_cfi} {
clean_restart "$binfile-${extension}"
- with_test_prefix "${extension}" {
-
- if ![runto callback] then {
- fail "has_cfi=$has_cfi: Can't run to callback"
- return false
- }
- gdb_test_no_output "maint frame-unwinder disable ARCH"
- return true
+ if ![runto callback] then {
+ fail "has_cfi=$has_cfi: Can't run to callback"
+ return false
}
+ gdb_test_no_output "maint frame-unwinder disable ARCH"
+ return true
}
if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
@@ -72,15 +69,45 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
return
}
-if { [prepare_test false] } {
- gdb_test "bt" \
+proc_with_prefix no-cfi {} {
+ if { ![prepare_test false] } {
+ return
+ }
+
+ set re_msg \
+ [string_list_to_regexp \
+ "Required frame unwinder may have been disabled," \
+ " see 'maint info frame-unwinders'"]
+ set hs {[^\r\n]}
+ set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+"
+ set re_bt_no_filters \
[multi_line \
- "\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \
- "#0\\s+callback \\(\\) \[^\r\n\]+"] \
- "verify unwind fail without CFI"
+ $re_bt_line \
+ $re_msg]
+ gdb_test "bt -no-filters" \
+ $re_bt_no_filters \
+ "verify no-filters unwind fail"
+
+ # Flush frame cache to retrigger the message.
+ gdb_test "maint flush register-cache" \
+ [string_to_regexp "Register cache flushed."]
+
+ # This output may occur when we run into the message while applying the
+ # frame filters.
+ set re_bt \
+ [multi_line \
+ $hs+$re_msg \
+ $re_bt_line]
+ gdb_test "bt" \
+ "($re_bt|$re_bt_no_filters)" \
+ "verify unwind fail"
}
-if { [prepare_test true] } {
+proc_with_prefix cfi {} {
+ if { ![prepare_test true] } {
+ return
+ }
+
if { [istarget "arm*-*-*"] } {
setup_kfail backtrace/31950 *-*-*
}
@@ -89,6 +116,12 @@ if { [prepare_test true] } {
# #1 0x00000000004004e9 in caller ()
# #2 0x00000000004004cd in main () at ...
gdb_test "bt" \
- "#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \
- "Verify unwinding works based only on CFI information"
+ [multi_line \
+ "#0 +callback $text" \
+ "#1 $text in caller $text" \
+ "#2 $text in main $text"] \
+ "Verify unwinding works"
}
+
+no-cfi
+cfi
diff --git a/gdb/testsuite/gdb.base/break-dbg.exp b/gdb/testsuite/gdb.base/break-dbg.exp
index 3652b8e..a7c7d92 100644
--- a/gdb/testsuite/gdb.base/break-dbg.exp
+++ b/gdb/testsuite/gdb.base/break-dbg.exp
@@ -46,7 +46,17 @@ gdb_test "catch load" "^Catchpoint $decimal \\(load\\)"
gdb_test "catch unload" "^Catchpoint $decimal \\(unload\\)"
gdb_test "catch signal" "^Catchpoint $decimal \\(standard signals\\)"
-gdb_test "catch syscall" "^Catchpoint $decimal \\(any syscall\\)"
+
+set re_warning_xml_disabled \
+ [string_to_regexp \
+ [join \
+ [list \
+ "warning: Can not parse XML syscalls information;" \
+ "XML support was disabled at compile time."]]]
+gdb_test "catch syscall" \
+ [multi_line \
+ "^($re_warning_xml_disabled" \
+ ")?Catchpoint $decimal [string_to_regexp {(any syscall)}]"]
gdb_test "watch -l global_var" "\[Ww]atchpoint $decimal: -location global_var"
diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.multi/pending-bp.exp
index 1cd1cfb..2458cd7 100644
--- a/gdb/testsuite/gdb.multi/pending-bp.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp.exp
@@ -328,5 +328,7 @@ proc_with_prefix py_test_clear_thread {} {
# Run all the tests.
test_no_inf_display
test_pending_toggle
-py_test_toggle_thread
-py_test_clear_thread
+if { [allow_python_tests] } {
+ py_test_toggle_thread
+ py_test_clear_thread
+}
diff --git a/gprofng/src/Stabs.cc b/gprofng/src/Stabs.cc
index 116316e..20bdf8b 100644
--- a/gprofng/src/Stabs.cc
+++ b/gprofng/src/Stabs.cc
@@ -1546,7 +1546,7 @@ Stabs::readSymSec (Elf *elf, bool is_dynamic)
switch (GELF_ST_TYPE (Sym.st_info))
{
case STT_FUNC:
- if (Sym.st_size == 0 || ELF_ST_BIND (Sym.st_info) == STB_WEAK)
+ if (Sym.st_size == 0)
break;
if (Sym.st_shndx == 0)
{
diff --git a/ld/testsuite/ld-elf/linkonce1.d b/ld/testsuite/ld-elf/linkonce1.d
index e4f9a70..3920f25 100644
--- a/ld/testsuite/ld-elf/linkonce1.d
+++ b/ld/testsuite/ld-elf/linkonce1.d
@@ -2,11 +2,10 @@
#source: linkonce1b.s
#ld: -r
#objdump: -r
+#notarget: [is_generic]
.*: file format .*
#...
-RELOCATION RECORDS FOR \[.debug_frame\]:
-OFFSET[ ]+TYPE[ ]+VALUE[ ]*
-.*(NONE|unused|UNUSED).*\*ABS\*
+RELOCATION RECORDS FOR \[.debug_frame\]: \(none\)
#pass
diff --git a/ld/testsuite/ld-elf/linkonce3.d b/ld/testsuite/ld-elf/linkonce3.d
new file mode 100644
index 0000000..25306d2
--- /dev/null
+++ b/ld/testsuite/ld-elf/linkonce3.d
@@ -0,0 +1,13 @@
+#source: linkonce1a.s
+#source: linkonce1b.s
+#ld: -r
+#objdump: -r
+#target: [is_generic]
+
+.*: file format .*
+#...
+RELOCATION RECORDS FOR \[.debug_frame\]:
+OFFSET[ ]+TYPE[ ]+VALUE[ ]*
+.*(NONE|unused|UNUSED).*\*ABS\*
+
+#pass