| Age | Commit message (Collapse) | Author | Files | Lines |
|
with immediates
|
|
files when disassemblng.
|
|
Remove static variables do_ctf and do_sframe that are set but never
read, causing build failures with LLVM's extended
-Wunused-but-set-variable warning.
These variables are dead code:
- Declared at lines 244-245 as static booleans
- Set to true when --ctf or --sframe options are parsed
- Never actually used or read anywhere in the code
- The actual dump functionality is triggered by request_dump() calls
Build error with -Werror enabled:
binutils/readelf.c:244:13: error: variable 'do_ctf' set but not used
[-Werror,-Wunused-but-set-variable]
binutils/readelf.c:245:13: error: variable 'do_sframe' set but not used
[-Werror,-Wunused-but-set-variable]
|
|
For elf/x86, --rosegment places code after read-only data, instead of
before read-only data. Pass --no-rosegment to ld in some linker tests
to avoid extra linker test failures when binutils is configured with
--enable-rosegment for elf/x86.
binutils/
PR ld/34003
* testsuite/lib/binutils-common.exp (check_rosegment_support): New.
(run_dump_test): Make NO_ROSEGMENT_LDFLAGS global.
ld/
PR ld/34003
* testsuite/config/default.exp (NO_ROSEGMENT_LDFLAGS): New.
* testsuite/ld-elf/mbind1a.d: Pass $NO_ROSEGMENT_LDFLAGS to ld.
* testsuite/ld-elf/pr26256-2b.d: Likewise.
* testsuite/ld-srec/srec.exp (extra_flags): Add
$NO_ROSEGMENT_LDFLAGS.
* testsuite/ld-x86-64/no-plt.exp: Pass -Wl,--no-rosegment to
compiler.
* testsuite/ld-x86-64/pr27491-1c.d: Pass --no-rosegment to ld.
* testsuite/ld-x86-64/pr27491-2.d: Likewise.
* testsuite/ld-x86-64/pr27491-3.d: Likewise.
* testsuite/ld-x86-64/pr27491-4.d: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
arm-linux-gnueabi allows OS/ABI to be set to ELFOSABI_GNU, but plain
arm-linux-gnu like arm-elf is ELFOSABI_ARM.
|
|
Signed-off-by: Indu Bhagat <ibhagatgnu@gmail.com>
|
|
Leaving files in tmpdir/ is generally okay (often intended and helpful),
but the main directory really shouldn't be cluttered.
|
|
Both leave the generated assembler file around. Maybe that's okay-ish
when left in tmpdir/, but the main directories really shouldn't be
cluttered. The file actually doesn't even need putting there when not
working with a remote host.
The SFrame test additionally leaves an a.out file in the main directory,
then the assembler output isn't really of interest anyway.
|
|
Currently if you attempt to link an object file with sframe version 2
contents, the linker will complain in _bfd_elf_merge_section_sframe
and fail to produce an output. This affects anyone who has objects
assembled by binutils-2.45 with .sframe sections. A work-around is to
pass --discard-sframe to ld.
Ideally the linker would rewrite version 2 sframe input to version 3,
but in the absence of that support it would be nicer if ld just
ignored version 2 (or 1) sframe sections without needing to pass
--discard-sframe. That is the aim of this patch.
It does so by checking the sframe version in _bfd_elf_parse_sframe
where various failing checks result in an error being printed and the
section not being marked as SEC_INFO_TYPE_SFRAME, but causes no
overall linker failure. In addition, an sframe version failure now
also marks the sframe section with SEC_EXCLUDE. This is also done for
other sframe failures. See the changelog below for other fixes.
bfd/
* elf-sframe.c (_bfd_elf_merge_section_sframe): Don't check
sframe version here.
(_bfd_elf_parse_sframe): Check sframe version here instead.
Do the "already parsed" check first. Reorder various other
checks. Do not bother parsing or print errors when
discard_sframe is set. Free section contents on failure
paths. Set SEC_EXCLUDE for fails. Check for NULL bfd_zalloc
return, and only allocate after successfully parsing sframe.
On errors report that the section will be ignored, not "no
.sframe will be created".
binutils/
* testsuite/lib/binutils-common.exp: Ignore sframe version
errors.
|
|
This patch just tidies the code a little. By using tcl {} quoting
rather than "" we can reduce the need for backslash quoting.
* testsuite/lib/binutils-common.exp (prune_warnings_extra): Use
tcl {} quoting.
|
|
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
|
|
We don't need this definition any more. Incidentally, the poisoning
wasn't effective in gas since the define came after bfd.h was
included.
|
|
Rather than aborting, use "unknown relative" as the reloc type should
display_elf_relocation_at want to print a relocation. Also fix
another case where readelf doesn't understand the relocation and sets
all_relocations[i].r_name to NULL.
PR 33743
* readelf.c (dump_relr_relocations): Don't abort on unknown
e_machine.
(dump_relocations): Don't assume we can pass NULL to a %s
format.
|
|
Commit 893eb49c9b12 exposed a gcc-4.9 build error, with gcc-4.9
erroneously complaining that F_MIN_SUBSECTION_DATA_LEN has a
non-constant initialisation.
* readelf.c (F_MIN_SUBSECTION_DATA_LEN): Use #define to work
around gcc-4.9 bug.
(F_SUBSECTION_LEN, F_SUBSECTION_COMPREHENSION),
(F_SUBSECTION_ENCODING): Use #define here too.
(elf_parse_attrs_subsection_v2): Adjust format string.
|
|
Given a short attributes section, elf_parse_attrs_subsection_v2 prints
an error message but does not return an error status or consume any
input. That results in endless printing of "Object attributes section
ends prematurely". The length checks also ignored a single excess
byte at the end of the section.
* readelf.c (elf_parse_attrs_subsection_v2): Move various
constants out of function. Don't check for min length here..
(process_attributes_v2): ..do so here instead.
|
|
Add a missing dash to indicate j is a flag
Signed-off-by: RocketDev <marocketbd@gmail.com>
|
|
Also fix typos in objdump options (-wD/-wE should be -WD/-WE),
and move ar man synopsis where it belongs.
|
|
Print "Address size" rather than "Pointer Size" and "Segment size"
rather than "Segment Size", using the same names and capitalisation
as is used when printing other headers with these fields.
binutils/
* dwarf.c
* testsuite/binutils-all/i386/compressed-1a.d
* testsuite/binutils-all/x86-64/compressed-1a.d
gas/
* testsuite/gas/aarch64/dwarf.d: Update expected output.
* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
* testsuite/gas/elf/dwarf-5-irp.d: Likewise.
* testsuite/gas/elf/dwarf2-20.d: Likewise, and match mn10200
output, removing xfail.
|
|
The field is named "address size" in all versions of the DWARF spec
that have and name the field. Reflect that by renaming
ar_pointer_size to ar_address_size.
|
|
The abort is due to an unexpected DW_FORM_addrx3 entry in the
testcase, which requires pointer_size to be known.
* dwarf.c (address_size_ok): New function.
(read_debug_line_header): Use address_size_ok.
(display_formatted_table): Pass li_address_size as
pointer_size to read_and_display_attr_value.
(display_debug_lines_decoded): Likewise.
(display_debug_macro, display_debug_names): Similarly pass
offset_size.
(display_loclists_unit_header): Use address_size_ok.
(display_debug_loc, display_debug_addr): Likewise.
(display_debug_aranges): Likewise. Remove power of two check
on address_size. Calculate and pad to tuple_size.
|
|
Add support to BFD for file collections pretending to be archives, with
the usual linker symbol resolution semantics as with actual archives.
This is an underlying feature to implement `--start-lib'/`--end-lib'
group support of the GOLD linker being phased out.
It comes in the form of `bfd_openr_fake_archive' function which arranges
for a list of input files supplied to be treated as an archive, with
`bfd_openr_next_archived_file' then referring to successive elements of
the list previously supplied.
Use the BFD pointer member of the first file and proxy handle members of
`struct bfd' and `struct artdata' respectively to hold references to the
members of such an artificial archive once arranged. Such an archive
has to be a mapless one necessarily and any use will require a symbol
index to be produced on the fly.
Add assertions throughout backend code that is supposed not to be ever
reached in the handling of such archives and which continues to use the
first file and proxy handle members of `struct bfd' and `struct artdata'
solely to keep offsets into the owning archive file.
|
|
In preparation for the next change replace a file offset with a union
of one and a BFD pointer in `struct bfd' and `struct artdata' members
used to refer to archive members and rename the members accordingly.
No functional change at this point.
|
|
Expand linker mapless archive support from XCOFF targets only across the
remaining ones, except for VMS targets whose archive format always has a
symbol map. For this tranform BFD code used by AR to produce symbol
maps to archive files such as to have a handler supplied to either write
a map to a file or convert symbol data to an archive symbol definition
table attached to an archive BFD as if read from a symbol map, but using
pointers to member BFDs rather than file offsets. Retain XCOFF handling
code as it is.
Where the archive group feature is used a given archive may be opened
multiple times in a single link. If this happens then a reference to a
symbol the definition of which is provided by said archive will change
from undefined on the first access to the archive to defined on later
accesses. The symbol table is pulled from an archive only for undefined
references, so if a symbol table has been pulled on first access and
then dropped by on-the-fly symbol map generation on a subsequent access,
then the symbol table is never re-read. Later on when the linker wants
to access it to actually resolve symbol references it won't have been
reloaded and a crash would happen on a null pointer dereference.
To prevent this from happening add code to `_bfd_compute_and_push_armap'
to let the caller request the symbol table to be retained and ask for it
when building a symbol map on the fly in the linker. The symbol table
will likely be used further down the link anyway.
Additionally always check the format of the first member of an archive,
even if no symbol map is present, and respect the format determined, so
that the correct format is used even if it is not the default one the LD
has been configured for, preventing segmentation faults from triggering
in `cris-aout' LD with the default (`crisaout') emulation or with the
`criself' emulation explicitly requested where archive members are in
the ELF format and consequntly removing failures with new tests:
cris-aout -FAIL: CRIS regular archive w/o index link (explicit emulation)
cris-aout -FAIL: CRIS regular archive w/o index link (implicit emulation)
cris-aout -FAIL: CRIS thin archive w/o index link (explicit emulation)
cris-aout -FAIL: CRIS thin archive w/o index link (implicit emulation)
Update documentation and adjust test cases accordingly now that mapless
archives are accepted for link by all targets except for VMS ones, which
never produce them in the first place.
|
|
When compiling with gcc 15, I get these:
CC prdbg.o
/home/simark/src/binutils-gdb/binutils/prdbg.c: In function ‘tg_start_function’:
/home/simark/src/binutils-gdb/binutils/prdbg.c:2658:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
2658 | sep = strchr (name, '(');
| ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1220: prdbg.o] Error 1
CC addr2line.o
/home/simark/src/binutils-gdb/binutils/addr2line.c: In function ‘translate_addresses’:
/home/simark/src/binutils-gdb/binutils/addr2line.c:390:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
390 | h = strrchr (filename, '/');
| ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:1220: addr2line.o] Error 1
CC nm.o
/home/simark/src/binutils-gdb/binutils/nm.c: In function ‘print_symname’:
/home/simark/src/binutils-gdb/binutils/nm.c:689:21: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
689 | char *atver = strchr (name, '@');
| ^~~~~~
cc1: all warnings being treated as errors
I think they are related to the fact that strchr having changed to
return const when passed a const.
Change-Id: Idb829916378f0a18e717d1e80414aaa5eba4f7f0
|
|
PR 33897
* dwarf.c (display_debug_frames): Don't calculate "look_for"
until we have checked that cie_off is valid.
|
|
Not a significant leak, but there is no need for this strdup.
* readelf (parse_args): Don't strdup ".sframe" passed to
request_dump_byname.
|
|
releases there should be both binutils.tar and binutils-with-gold.tar files.
|
|
|
|
file after making the 2.46 release.
|
|
Currently, when a user specifies both -WF (to dump DWARF Frame) and
--sframe, the dump_dwarf () call is triggered twice,
First, in dump_bfd ():
if (dump_dwarf_section_info)
dump_dwarf (abfd, is_mainfile);
And then again in dump_bfd () via:
if (dump_sframe_section_info)
dump_sframe_section (abfd, dump_sframe_section_name, is_mainfile);
Where dump_sframe_section () itself invokes dump_dwarf () to emit SFrame
section.
The original intent of making dump_sframe_section () to invoke
dump_dwarf () was to reuse the existing (DWARF) machinery for relocation
and emission of SFrame section (along with DWARF sections). But this
may cause duplicate emission as noted above (PR 33806).
So, carve out the necessary work into dump_sframe_section () to make it
not invoke dump_dwarf (): explicitly load the SFrame section and then
invoke the associated display function directly. This ensures that the
SFrame textual dump is emitted exactly once as intended.
Additionally, this patch removes:
- the temporary "sframe-internal-only" debug option because it not
needed anymore, now that we dont use dump_dwarf () for SFrame dumping
anymore.
- stubs from dump_dwarf_section () specific to SFrame, as it is not
called for it anymore.
While at it, xstrdup consistently and free the dump_sframe_section_name
var.
Update the existing sframe-func.s to ensure .eh_frame section is emitted
as well. Add new test objdump-sframe-2.d to verify that textual dump
using objdump contains single textual dumps of .eh_frame and .sframe (if
both --sframe and -WF are specified).
PR libsframe/33806
binutils/
PR libsframe/33806
* dwarf.c (debug_option_table): Remove sframe-internal-only.
* objdump.c (dump_sframe_section): Call display function
directly instead of dump_dwarf.
(dump_bfd): Update call to dump_sframe_section.
(main): Remove 'sframe-internal-only' hack.
binutils/testsuite/
* binutils-all/x86-64/sframe-func.s: Emit .eh_frame section as
well.
* binutils-all/x86-64/objdump-sframe-2.d: New test.
|
|
|
|
Adds the new option --map-global-vars to objdump. This displays the type and location of global files in binaries that contain suiteable debug information.
|
|
objdump -D disassembles non-code sections, paying no heed to symbols
in those sections. I think "objdump -d -j .data" should do the same,
ie. not switch into dumping the section as data because an object
symbol is encountered.
On the other hand, dissassembly of .plt which is a code section, can
dump the first part of .plt as data due to the presense of
_PROCEDURE_LINKAGE_TABLE_. Fix that too.
PR 33243
PR 33389
PR 33515
binutils/
* objdump.c (disassemble_section): Ignore symbols in non-code
sections. Ignore _PROCEDURE_LINKAGE_TABLE_ too.
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't
xfail on Solaris/amd64.
ld/
* testsuite/ld-aarch64/rela-abs-relative-be.d,
* testsuite/ld-aarch64/rela-abs-relative-opt.d,
* testsuite/ld-aarch64/rela-abs-relative.d,
* testsuite/ld-mips-elf/no-shared-1-n32.d,
* testsuite/ld-mips-elf/no-shared-1-n64.d,
* testsuite/ld-mips-elf/no-shared-1-o32.d: Update expected output.
|
|
This reverts commit 45cf0b829303, which isn't needed after commit
6d7e5bcca5. Mapping symbols are like any other local symbol, and
shouldn't appear after the end of a section.
The real bug that resulted in both of these commits is that st_value
in an executable or shared library is the symbol address. It was
wrong to compare an address against a section size (you'd need to
subtract off the section vma first). The second commit limited the
warning to ET_REL where st_value is a section offset and thus can be
compared directly to the section size.
|
|
|
|
non-SHF_ALLOC SHT_SUNW_symsort and SHT_SUNW_symnsort sections aren't
removed when all symbols are removed. Fix that.
PR 33718
PR 33684
* objcopy.c (is_strip_section_1): Handle SHT_SUNW_symsort and
SHT_SUNW_symnsort sections.
|
|
|
|
|
|
As reported in PR binutils/33243, one test FAILs on Solaris/amd64:
FAIL: gnu-debuglink (objdump 1)
30c30,32
< 400660: ff 35 b2 15 00 00 ff 25 b4 15 00 00 0f 1f 40 00 .5.....%......@.
---
> 400660: ff 35 b2 15 00 00 push 0x15b2(%rip) # 401c18 <_GLOBAL_OFFSET_TABLE_+0x8>
> 400666: ff 25 b4 15 00 00 jmp *0x15b4(%rip) # 401c20 <_GLOBAL_OFFSET_TABLE_+0x10>
> 40066c: 0f 1f 40 00 nopl 0x0(%rax)
This is another instance of PR binutils/33389, so this patch xfail's the
test.
Tested on {amd64,i386}-pc-solaris2.11 and {x86_64,i686}-pc-linux-gnu.
2026-01-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
binutils:
PR binutils/33243
PR binutils/33389
* testsuite/binutils-all/compress.exp (test_gnu_debuglink): xfail
on Solaris/amd64.
|
|
|
|
The only macros allowed are the ones specially handled by gettext,
such as PRId64.
* objcopy.c (copy_usage): Don't use string literal
concatenation of macros in translated strings.
Patch from Andreas Schwab <schwab@linux-m68k.org>
|
|
Users of "readelf" report problems running the tool's DWARF dump flag
on binaries built with the most recent version of the Go compiler (1.25),
Go bug report here https://github.com/golang/go/issues/77246
dwarf.c (skip_attribute <DW_FORM_string>): Skip terminating NUL too.
|
|
PR 33837
* readelf.c (process_got_section_contents): Use ngettext.
|
|
|
|
|
|
When invoking windres with a preprocessor parameter that contains angled
brackets, the shell will try to interpret them, leading to an error.
For example with an empty test.rc file:
$ i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
sh: 1: cannot open foo: No such file
i686-w64-mingw32-windres: preprocessing failed.
After patch it correctly complains about no resources baked in:
$ ./i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
./i686-w64-mingw32-windres: no resources
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
|
|
Add vxworks and windiss to supported targets. is_elf_target excludes
them as a hack to work around multiple other elf test failures.
On these targets, fixes
FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
|
|
submissions.
|
|
One line in is_elf_format isn't indented correctly.
Fixed thus.
Tested on x86_64-pc-linux-gnu.
2026-01-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
binutils:
* testsuite/lib/binutils-common.exp (is_elf_format): Fix
indentation.
|
|
The documentation for --add-gnu-debuglink and --extract-symbol
uses diverse formatting styles for list items, including @table and
manual bullets. This looked broken in the generated man pages, showing
raw text artifacts like "*<..>" instead of real bullet points.
This patch unifies these sections to use @itemize @bullet, resulting in
cleaner output and better readability for these options.
binutils/
* doc/binutils.texi (objcopy): Use @itemize @bullet
for --add-gnu-debuglink and --extract-symbol.
|