Bug 31868

Summary: Provide diagnostic option for ISA marker notes
Product: binutils Reporter: Sam James <sam>
Component: ldAssignee: H.J. Lu <hjl.tools>
Status: RESOLVED FIXED    
Severity: normal CC: fweimer, hjl.tools
Priority: P2    
Version: 2.43   
Target Milestone: 2.43   
See Also: https://sourceware.org/bugzilla/show_bug.cgi?id=31867
Host: Target:
Build: Last reconfirmed:

Description Sam James 2024-06-09 13:53:14 UTC
I actually thought this already existed but I can't find it. It would've been helpful in PR31867.

Could ld have an option to explain why it's adding an x86 ISA marker (e.g. inherited from X object)?
Comment 1 H.J. Lu 2024-06-09 21:10:28 UTC
Can you pass "--dependency-file DEP" to ld and run "readelf -n" on all relocatable
input files in DEP?
Comment 2 H.J. Lu 2024-06-12 04:04:39 UTC
A patch is posted at

https://sourceware.org/pipermail/binutils/2024-June/134706.html
Comment 3 Sam James 2024-06-14 04:09:32 UTC
(In reply to H.J. Lu from comment #1)
> Can you pass "--dependency-file DEP" to ld and run "readelf -n" on all
> relocatable
> input files in DEP?

I hadn't thought of this. I'll try find some time to try it, but...

(In reply to H.J. Lu from comment #2)
> A patch is posted at
> 
> https://sourceware.org/pipermail/binutils/2024-June/134706.html

I'd rather spend the time playing with this ;)

Thanks. I'll try it out.
Comment 4 Sourceware Commits 2024-06-14 20:42:28 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=93548ee191ff95cae0592363b579c6addb0b151d

commit 93548ee191ff95cae0592363b579c6addb0b151d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 11 20:55:05 2024 -0700

    x86: Add -z isa-level-report=[none|all|needed|used]
    
    Add -z isa-level-report=[none|all|needed|used] to the x86 ELF linker to
    report needed and used x86-64 ISA levels.
    
    bfd/
    
            PR ld/31868
            * elf-linker-x86.h (elf_x86_isa_level_report): New.
            (elf_linker_x86_params): Add isa_level_report.
            * elfxx-x86.c (report_isa_level): New.
            (_bfd_x86_elf_link_setup_gnu_properties): Check
            -z isa-level-report=[none|all|needed|used] to report needed and
            used x86-64 ISA level.
    
    ld/
    
            PR ld/31868
            * NEWS: Mention -z isa-level-report=[none|all|needed|used].
            * ld.texi: Document -z isa-level-report=[none|all|needed|used].
            * emulparams/elf32_x86_64.sh: Source x86-64-level-report.sh.
            * emulparams/elf_i386.sh: Likewise.
            * emulparams/elf_x86_64.sh: Likewise.
            * emulparams/x86-64-level-report.sh: New file.
            * testsuite/ld-i386/pr31868a.d: Likewise.
            * testsuite/ld-i386/pr31868b.d: Likewise.
            * testsuite/ld-i386/pr31868c.d: Likewise.
            * testsuite/ld-x86-64/pr31868a-x32.d: Likewise.
            * testsuite/ld-x86-64/pr31868a.d: Likewise.
            * testsuite/ld-x86-64/pr31868a.l: Likewise.
            * testsuite/ld-x86-64/pr31868a.s: Likewise.
            * testsuite/ld-x86-64/pr31868b-x32.d: Likewise.
            * testsuite/ld-x86-64/pr31868b.d: Likewise.
            * testsuite/ld-x86-64/pr31868b.l: Likewise.
            * testsuite/ld-x86-64/pr31868b.s: Likewise.
            * testsuite/ld-x86-64/pr31868c-x32.d: Likewise.
            * testsuite/ld-x86-64/pr31868c.d: Likewise.
            * testsuite/ld-x86-64/pr31868c.l: Likewise.
            * testsuite/ld-i386/i386.exp: Run PR ld/31868 tests.
            * testsuite/ld-x86-64/x86-64.exp: Likewise.
    
    Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Comment 5 H.J. Lu 2024-06-14 23:18:03 UTC
Fixed.