Age | Commit message (Collapse) | Author | Files | Lines |
|
mips64-linux-gnuabi64 +FAIL: GOT page 4 (two files)
mipsel-linux-gnu +FAIL: GOT page 4 (two files)
mipsisa32el-linux-gnu +FAIL: GOT page 4 (two files)
mips-linux-gnu +FAIL: GOT page 4 (two files)
powerpc64-freebsd +FAIL: relocatable relaxing large
powerpc64le-linux-gnu +FAIL: relocatable relaxing large
powerpc64-linux-gnu +FAIL: relocatable relaxing large
powerpc-eabisim +FAIL: relocatable relaxing large
powerpc-eabivle +FAIL: relocatable relaxing large
powerpc-freebsd +FAIL: relocatable relaxing large
powerpcle-elf +FAIL: relocatable relaxing large
powerpc-linux-gnu +FAIL: relocatable relaxing large
* elflink.c (bfd_elf_final_link): Heed bed->use_mmap when
sizing buffers, not just USE_MMAP.
|
|
I committed a broken patch.
* aoutx.h (aout_get_external_symbols): Remove wrong #else and
unneeded casts.
* pdp11.c (aout_get_external_symbols): Likewise.
|
|
Commit c6291d749aec introduced a number of errors, found by clang.
elf.c:456:7: error: variable 'alloc_ext_size' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (_bfd_mul_overflow (symcount, extsym_size, &amt))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elf.c:464:7: error: variable 'alloc_extshndx_size' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (bfd_seek (ibfd, pos, SEEK_SET) != 0
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elflink.c:2837:11: error: variable 'alloc1_size' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (internal_relocs == NULL)
^~~~~~~~~~~~~~~~~~~~~~~
elflink.c:12595:16: error: variable 'ext_size' set but not used [-Werror,-Wunused-but-set-variable]
size_t ext_size = 0;
* elf.c (bfd_elf_get_elf_syms): Fix use of uninitialised variables.
* elflink.c (_bfd_elf_link_info_read_relocs): Likewise.
(bfd_elf_final_link): Fix set but not used warning.
|
|
If mmap is used without sanity checking, then we'll get a SIGBUS if
an access is done to the mmap'd memory corresponding to a page past
end of file.
* aoutx.h (aout_get_external_symbols): Check that mmap regions
are within file contents. Catch stringsize overflow.
(some_aout_object_p): Don't clear already zeroed fields. Tidy.
* pdp11.c: As for aoutx.h. Copy some fixes too.
|
|
|
|
To copy input section contents, add _bfd_elf_link_mmap_section_contents
and _bfd_elf_link_munmap_section_contents to mmap in the input sections.
* elf-bfd.h (_bfd_elf_link_mmap_section_contents): New.
(_bfd_elf_link_munmap_section_contents): Likewise.
* elf.c (elf_mmap_section_contents): New.
(_bfd_elf_mmap_section_contents): Use it.
(_bfd_elf_link_mmap_section_contents): New.
(_bfd_elf_link_munmap_section_contents): Likewise.
* elflink.c (elf_link_input_bfd): Call
_bfd_elf_link_mmap_section_contents instead of
bfd_get_full_section_contents. Call
_bfd_elf_link_munmap_section_contents to munmap the section
contents.
(bfd_elf_final_link): When mmap is used, initialize
max_contents_size to _bfd_minimum_mmap_size and increase it
for compressed or linker created sections or sections whose
rawsize != size.
|
|
When --no-keep-memory is used, the symbol table and relocation info for
eh_frame are freed after they are retrieved for each text section in the
input object. If an input object has many text sections, the same data
is retrieved and freed many times which can take a very long time.
Update _bfd_elf_gc_mark to keep the symbol table and relocation info for
eh_frame to avoid it. Data to link the 3.5GB clang executable in LLVM
17 debug build on Linux/x86-64 with 32GB RAM is:
before after improvement
user 86.31 86.44 -0.2%
system 8.77 8.63 1.6%
total 95.58 96.81 -1.3%
maximum set(GB) 13.1 13.1 0%
page faults 3024752 3028699 -1.3%
and data to link the 275M cc1plus executable in GCC 14 stage 1 build is:
user 5.49 5.46 -0.5%
system 0.73 0.73 0%
total 6.26 6.25 0.3%
maximum set(MB) 964 964 0%
page faults 235173 235796 -0.3%
The memory usage impact is minimum and the link time of the Rust binary
in
https://sourceware.org/bugzilla/show_bug.cgi?id=31466
is reduced from 500+ seconds to 1.44 seconds, a 300x speedup.
PR ld/31466
* elflink.c (init_reloc_cookie): Add a bool argument, keep_memory,
for keeping memory. Always keep memory if keep_memory is true.
(init_reloc_cookie_rels): Likewise
(init_reloc_cookie_for_section): Add a bool argument for keeping
memory and pass it to init_reloc_cookie and
init_reloc_cookie_rels.
(_bfd_elf_gc_mark_reloc): Pass false to _bfd_elf_gc_mark.
(_bfd_elf_gc_mark): Pass true to init_reloc_cookie_for_section
for the eh_frame section. Pass false to
init_reloc_cookie_for_section for other sections.
(_bfd_elf_gc_mark_extra_sections): Add Add a bool argument for
keeping memory and pass it to _bfd_elf_gc_mark.
(bfd_elf_parse_eh_frame_entries): Pass false to init_reloc_cookie
and init_reloc_cookie_rels.
(bfd_elf_gc_sections): Pass false to init_reloc_cookie_for_section
and _bfd_elf_gc_mark.
(bfd_elf_discard_info): Pass false to
init_reloc_cookie_for_section and init_reloc_cookie.
|
|
During a "-j 8" LLVM 17 debug build on a machine with 32GB RAM and 16GB
swap, ld was killed by kernel because of out of memory:
[79437.949336] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-9.scope,task=ld,pid=797431,uid=1000
[79437.949349] Out of memory: Killed process 797431 (ld) total-vm:9219600kB, anon-rss:6558156kB, file-rss:1792kB, shmem-rss:0kB, UID:1000 pgtables:17552kB oom_score_adj:0
Don't cache symbol nor relocation tables if they are mapped in. Data to
link the 3.5GB clang executable in LLVM 17 debug build on Linux/x86-64
with 32GB RAM is:
stdio mmap improvement
user 86.73 87.02 -0.3%
system 9.55 9.21 3.6%
total 100.40 97.66 0.7%
maximum set(GB) 17.34 13.14 24%
page faults 4047667 3042877 25%
and data to link the 275M cc1plus executable in GCC 14 stage 1 build is:
user 5.41 5.44 -0.5%
system 0.80 0.76 5%
total 6.25 6.26 -0.2%
maximum set(MB) 1323 968 27%
page faults 323451 236371 27%
These improve the overall system performance for parallel build by
reducing memory usage and page faults.
Also rename _bfd_link_keep_memory to _bfd_elf_link_keep_memory. Since
the --no-keep-memory linker option causes:
https://sourceware.org/bugzilla/show_bug.cgi?id=31458
this is opt-in by each backend.
bfd/
* elf32-i386.c (elf_i386_scan_relocs): Remove
_bfd_link_keep_memory.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
* elflink.c (_bfd_elf_link_keep_memory): New.
(_bfd_elf_link_iterate_on_relocs): Replace _bfd_link_keep_memory
with _bfd_elf_link_keep_memory.
(elf_link_add_object_symbols): Likewise.
(init_reloc_cookie): Likewise.
(init_reloc_cookie_rels): Likewise.
* libbfd-in.h (_bfd_link_keep_memory): Removed.
* linker.c (_bfd_link_keep_memory): Likewise.
* libbfd.h: Regenerated.
|
|
Add _bfd_mmap_read_temporary to mmap in symbol tables and relocations
whose sizes >= 4 * page size. For the final link, allocate an external
relocation buffer of 4 * page size to avoid using mmap and munmap on
smaller relocation sections. Since _bfd_mmap_read_temporary allocates
buffer as needed, its callers don't need to.
When mmap is used to map in all ELF sections, data to link the 3.5GB
clang executable in LLVM 17 debug build on Linux/x86-64 with 32GB RAM
is:
stdio mmap improvement
user 84.79 85.27 -0.5%
system 10.95 9.09 17%
total 97.91 94.90 3%
page faults 4837944 4033778 17%
and data to link the 275M cc1plus executable in GCC 14 stage 1 build
is:
user 5.31 5.33 -0.4%
system 0.86 0.76 12%
total 6.19 6.13 1%
page faults 361273 322491 11%
* elf.c (bfd_elf_get_elf_syms): Don't allocate buffer for external
symbol table. Replace bfd_read with _bfd_mmap_read_temporary.
* elflink.c (elf_link_read_relocs_from_section): Add 2 arguments
to return mmap memory address and size.
(_bfd_elf_link_info_read_relocs): Don't allocate buffer for
external relocation information. Replace bfd_read with
_bfd_mmap_read_temporary.
(bfd_elf_final_link): Cache external relocations up to
_bfd_minimum_mmap_size bytes when mmap is used.
* libbfd.c (_bfd_mmap_read_temporary): New.
* libbfd-in.h (_bfd_mmap_read_temporary): Likewise.
* libbfd.h: Regenerated.
|
|
Add _bfd_elf_mmap_section_contents and _bfd_elf_munmap_section_contents.
A backend must opt-in to use mmap. It should replace
bfd_malloc_and_get_section -> _bfd_elf_mmap_section_contents
free -> _bfd_elf_munmap_section_contents
on section contents.
* compress.c (bfd_get_full_section_contents): Don't allocate
buffer if mmapped_p is true.
* elf-bfd.h (elf_backend_data): Add use_mmap.
(bfd_elf_section_data): Add contents_addr and contents_size.
(_bfd_elf_mmap_section_contents): New.
(_bfd_elf_munmap_section_contents): Likewise.
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Replace
bfd_malloc_and_get_section and free with
_bfd_elf_mmap_section_contents and _bfd_elf_munmap_section_contents
on section contents.
* elf-sframe.c (_bfd_elf_parse_sframe): Likewise.
* elf.c (_bfd_elf_make_section_from_shdr): Replace
bfd_malloc_and_get_section and free with
_bfd_elf_mmap_section_contents and _bfd_elf_munmap_section_contents
on section contents.
(_bfd_elf_print_private_bfd_data): Likewise.
(_bfd_elf_mmap_section_contents): New.
(_bfd_elf_munmap_section_contents): Likewise.
* elf32-i386.c (elf_i386_scan_relocs): Replace
bfd_malloc_and_get_section and free with
_bfd_elf_mmap_section_contents and _bfd_elf_munmap_section_contents
on section contents.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
(elf_x86_64_get_synthetic_symtab): Likewise.
* elfcode.h (elf_checksum_contents): Likewise.
* elflink.c (elf_link_add_object_symbols): Likewise.
(bfd_elf_get_bfd_needed_list): Likewise.
* elfxx-target.h (elf_backend_use_mmap): New.
(elfNN_bed): Add elf_backend_use_mmap.
* elfxx-x86.c (elf_x86_size_or_finish_relative_reloc): Replace
bfd_malloc_and_get_section and free with
_bfd_elf_mmap_section_contents and _bfd_elf_munmap_section_contents
on section contents.
(_bfd_x86_elf_get_synthetic_symtab): Replace free with
_bfd_elf_munmap_section_contents.
* elfxx-x86.h (elf_backend_use_mmap): New.
* libbfd.c: Include "elf-bfd.h".
(_bfd_generic_get_section_contents): Call bfd_mmap_local for
mmapped_p.
* opncls.c (_bfd_delete_bfd): Also munmap ELF section contents.
* section.c (asection): Add mmapped_p.
(BFD_FAKE_SECTION): Updated.
(bfd_malloc_and_get_section): Add a sanity check for not
mmapped_p.
* bfd-in2.h: Regenerated.
|
|
There are many linker input files in LLVM debug build with huge string
sections. All these string sections can be treated as read-only. But
linker copies all of them into memory which consumes huge amount of
memory and slows down linker significantly.
Add _bfd_mmap_readonly_persistent and _bfd_mmap_readonly_temporary to
mmap in reado-only sections with size >= 4 * page size.
NB: All string sections in valid ELF inputs must be null terminated.
There is no need to terminate it again and string sections are mmapped
as read-only.
* bfd.c (bfd_mmapped_entry): New.
(bfd_mmapped): Likewise.
(bfd): Add mmapped.
* bfdwin.c (bfd_get_file_window): Use _bfd_pagesize.
* cache.c (cache_bmmap): Remove pagesize_m1 and use pagesize_m1
instead.
* elf.c (bfd_elf_get_str_section): Call
_bfd_mmap_readonly_persistent instead of _bfd_alloc_and_read.
Don't terminate the string section again.
(get_hash_table_data): Call _bfd_mmap_readonly_temporary and
_bfd_munmap_readonly_temporary instead of _bfd_malloc_and_read
and free.
(_bfd_elf_get_dynamic_symbols): Call _bfd_mmap_readonly_persistent
instead of _bfd_alloc_and_read. Don't terminate the string
section again. Call _bfd_mmap_readonly_temporary and
_bfd_munmap_readonly_temporary instead of _bfd_malloc_and_read
and free.
(_bfd_elf_slurp_version_tables): Call _bfd_mmap_readonly_temporary
and _bfd_munmap_readonly_temporary instead of _bfd_malloc_and_read
and free.
* elflink.c (bfd_elf_link_record_dynamic_symbol): Use bfd_malloc
to get the unversioned symbol.
* libbfd-in.h (_bfd_pagesize): New.
(_bfd_pagesize_m1): Likewise.
(_bfd_minimum_mmap_size): Likewise.
(_bfd_mmap_readonly_persistent): Likewise.
(_bfd_mmap_readonly_temporary): Likewise.
(_bfd_munmap_readonly_temporary): Likewise.
* libbfd.c
(bfd_allocate_mmapped_page): New.
(_bfd_mmap_readonly_temporary): Likewise.
(_bfd_munmap_readonly_temporary): Likewise.
(_bfd_mmap_readonly_persistent): Likewise.
(_bfd_pagesize): Likewise.
(_bfd_pagesize_m1): Likewise.
(_bfd_minimum_mmap_size): Likewise.
(bfd_init_pagesize): Likewise.
* lynx-core.c (lynx_core_file_p): Use _bfd_pagesize.
* opncls.c (_bfd_delete_bfd): Munmap tracked mmapped memories.
* sysdep.h (MAP_ANONYMOUS): New. Define if undefined.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
|
|
|
|
PR 31458
bfd/
* elf-bfd.h (_bfd_elf_link_read_relocs),
(_bfd_elf_link_info_read_relocs): Constify section.
* elflink.c: Likewise.
* elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Read
relocs again in case --no-keep-memory.
ld/
* testsuite/ld-mips-elf/mips-elf.exp: Run --no-keep-memory
version of eh-frame3 test.
|
|
PR30569 was triggered by a patch of mine 6540edd52cc0 moving the call
to always_size_sections in bfd_elf_size_dynamic_sections earlier, made
to support the x86 DT_RELR implementation. This broke mips16 code
handling stubs when --export-dynamic is passed to the linker, because
numerous symbols then became dynamic after always_size_sections. The
mips backend fiddles with symbols in its always_size_sections. Maciej
in 902e9fc76a0e had moved the call to always_size_sections to after
the export-dynamic code. Prior to that, Nathan in 04c3a75556c0 moved
it before the exec stack code, back to the start of
bfd_elf_size_dynamic_sections which was where Ian put it originally
in ff12f303355b. So the call has moved around a little. I'm leaving
it where it is, and instead calling mips_elf_check_symbols from
late_size_sections (the old size_dynamic_sections) which is now always
called. In fact, the whole of _bfd_mips_elf_early_size_sections can
be merged into _bfd_mips_elf_late_size_sections.
|
|
This largely mechanical patch is preparation for a followup patch.
For quite some time I've thought that it would be useful to call
elf_backend_size_dynamic_sections even when no dynamic objects are
seen by the linker. That's what this patch does, with some renaming.
There are no functional changes to the linker, just a move of the
dynobj test in bfd_elf_size_dynamic_sections to target backend
functions, replacing the asserts/aborts already there. No doubt some
of the current always_size_sections functions could be moved to
size_dynamic_sections but I haven't made that change.
Because both hooks are now always called, I have renamed
always_size_sections to early_size_sections and size_dynamic_sections
to late_size_sections. I condisdered calling late_size_sections plain
size_sections, since this is the usual target dynamic section sizing
hook, but decided that searching the sources for "size_sections" would
then hit early_size_sections and other functions.
|
|
|
|
The PA 2.0 architecture introduced several new load and store
instructions with long displacements. These include floating
point loads and stores for word mode, and integer and floating
point loads and stores for double words. Currently, ld does
not correctly support symbolic relocations for these instructions.
If these are used, ld applies the standard R_PARISC_DPREL14R
relocation and corrupts the instruction. This change uses
bfd_hppa_insn2fmt to determine the correct relocation format.
We need to check the computed displacement as the immediate
value used in these instruction must be a multiple of 4 or 8
depending on whether the access is for a word or double word.
A misaligned offset can potentially occur if the symbol is not
properly aligned or if $global$ (the global pointer) is not
double word aligned. $global$ is provided as a .data section
start symbol. The patch adjusts elf.sc and hppalinux.sh to
align .data to a 8-byte boundary in non-shared and non-pie
links.
2024-04-01 John David Anglin <danglin@gcc.gnu.org>
PR ld/31503
bfd/ChangeLog:
* elf32-hppa.c (final_link_relocate): Output
ld/ChangeLog:
* emulparams/hppalinux.sh (DATA_SECTION_ALIGNMENT): Define.
* scripttempl/elf.sc: Align .data section to DATA_SECTION_ALIGNMENT
when relocating.
|
|
Currently, whether GD and IE generate dynamic relocation is
determined by SYMBOL_REFERENCES_LOCAL and bfd_link_executable.
This results in dynamic relocations still being generated in some
situations where dynamic relocations are not necessary (such as
the undefined weak symbol in static links).
We use RLARCH_TLS_GD_IE_NEED_DYN_RELOC macros to determine whether
GD/IE needs dynamic relocation. If GD/IE requires dynamic relocation,
set need_reloc to true and indx to be a dynamic index.
At the same time, some test cases were modified to use regular
expression matching instead of complete disassembly matching.
|
|
|
|
To represent the first and third expression of .align, R_LARCH_ALIGN need to
associate with a symbol. We define a local symbol for R_LARCH_AGLIN.
But if the section of the local symbol is discarded, it may result in
a undefined symbol error.
Instead, we use the section name symbols, and this does not need to
add extra symbols.
During partial linking (ld -r), if the symbol associated with a relocation is
STT_SECTION type, the addend of relocation needs to add the section output
offset. We prevent it for R_LARCH_ALIGN.
The elf_backend_data.rela_normal only can set all relocations of a target to
rela_normal. Add a new function is_rela_normal to elf_backend_data, it can
set part of relocations to rela_normal.
|
|
|
|
|
|
|
|
|
|
|
|
When the linker sees an input object containing nothing but IR during
rescan, it should ignore it (LTO phase is over). But if the input object
is a fat IR object, which has non-IR code as well, it should be used to
resolve references as if it did not contain any IR at all. This patch
adds lto_type to bfd and linker avoids claiming a fat IR object if no IR
object should be claimed.
bfd/
PR ld/23935
* archive.c (_bfd_compute_and_write_armap): Check bfd_get_lto_type
instead of lto_slim_object.
* elflink.c (elf_link_add_object_symbols): Likewise.
* bfd.c (bfd_lto_object_type): New.
(bfd): Remove lto_slim_object and add lto_type.
(bfd_get_lto_type): New function.
* elf.c (lto_section): Removed.
(_bfd_elf_make_section_from_shdr): Don't set lto_slim_object.
* format.c: (lto_section): New.
(bfd_set_lto_type): New function.
(bfd_check_format_matches): Call bfd_set_lto_type.
* bfd-in2.h: Regenerated.
binutils/
PR ld/23935
* nm.c (display_rel_file): Check bfd_get_lto_type instead of
lto_slim_object.
ld/
PR ld/23935
* ldmain.c (add_archive_element): Don't claim a fat IR object if
no IR object should be claimed.
* testsuite/ld-plugin/lto.exp (pr20103): Adjust fat IR test.
Add PR ld/23935 test.
* testsuite/ld-plugin/pr23935a.c: New file.
* testsuite/ld-plugin/pr23935b.c: Likewise.
|
|
|
|
If a BFD user is making use of a function like
bfd_get_section_contents to read a section into a pre-allocated
buffer, then that BFD user might also want to make use of
_bfd_section_size_insane prior to allocating the buffer they intend to
use in order to validate that the buffer size that plan to allocate is
sane.
This commit makes _bfd_section_size_insane public, by renaming it to
bfd_section_size_insane.
I've updated the existing uses within bfd/, I don't believe this
function is used outside of bfd/ currently.
One place that I plan to make use of this function is in
gdb/gdb_bfd.c, in the function gdb_bfd_get_full_section_contents.
This change isn't included in this commit, but will come later if/when
this has been merged into bfd.
There should be no change in behaviour after this commit.
bfd/
* bfd-in2.h (bfd_section_size_insane): Add declaration.
* compress.c (bfd_get_full_section_contents): Update for new name
of _bfd_section_size_insane.
(bfd_init_section_compress_status): Likewise.
* dwarf2.c (read_section): Likewise.
(_bfd_dwarf2_slurp_debug_info): Likewise.
* libbfd.h (_bfd_section_size_insane): Remove declaration.
* section.c (_bfd_section_size_insane): Rename to ...
(bfd_section_size_insane): ... this.
binutils/
* readelf.c (uncompress_section_contents): Update comment to
account for new name of _bfd_section_size_insane.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PR 31455
|
|
This relaxation is effective for both macro instructions (call36, tail36)
and explicit relocation instructions (pcaddu18i + jirl).
call36 f -> bl f
R_LARCH_CALL36 -> R_LARCH_B26
tail36 $t0, f -> b f
R_LARCH_CALL36 -> R_LARCH_B26
|
|
|
|
bdfio.c is defining bfd_get_current_time which is returning a time_t.
This type is defined in time.h and thus, must be included in bfd main
header to avoid undefined type when include bfd.h.
Note that most of the time, <time.h> is pulled by <sys/stat.h> already
included in bfd.h. That's why it went unnoticed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Change the size type in the BFD mmap interface from bfd_size_type to
size_t to be consistent with the size type of the host mmap interface.
* bfdio.c (bfd_iovec): Change the bmmap size type to size_t.
(bfd_mmap): Likewise.
(memory_bmmap): Likewise.
* cache.c (cache_bmmap): Change the bmmap size type to size_t.
* opncls.c (opncls_bmmap): Change the bmmap size type to size_t.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
|
|
Use MAP_FAILED, instead of ((void *) -1), for mmap failure and use
((void *) -1) only if MAP_FAILED is undefined.
* bfdio.c (bfd_mmap): Replace (void *) -1 with MAP_FAILED for
mmap failure.
* bfdwin.c: Don't include <sys/mman.h>.
(MAP_FILE): Removed.
(bfd_get_file_window): Replace (void *) -1 with MAP_FAILED for
mmap failure.
* cache.c: Don't include <sys/mman.h>.
(cache_bmmap): Replace (void *) -1 with MAP_FAILED for mmap
failure.
* opncls.c (opncls_bmmap): Likewise.
* sysdep.h: Include <sys/mman.h> if HAVE_MMAP is define.
(MAP_FILE): New. Defined as 0 if undefined.
(MAP_FAILED): New. Defined as ((void *) -1) if undefined.
|
|
There is no need to call bfd_write with 0 size.
* elf-strtab.c (_bfd_elf_strtab_emit): Don't call bfd_write with
0 size.
|
|
Use -march=help for gas to print all supported extensions and versions.
Here is part of the output of `as -march=help`:
All available -march extensions for RISC-V:
e 1.9
i 2.1, 2.0
m 2.0
a 2.1, 2.0
f 2.2, 2.0
d 2.2, 2.0
q 2.2, 2.0
c 2.0
v 1.0
h 1.0
zicbom 1.0
zicbop 1.0
...
This patch assumes that the supported extensions with the same versions
are listed together. For example:
static struct riscv_supported_ext riscv_supported_std_ext[] =
{
...
{"i", ISA_SPEC_CLASS_20191213, 2, 1, 0 },
{"i", ISA_SPEC_CLASS_20190608, 2, 1, 0 },
{"i", ISA_SPEC_CLASS_2P2, 2, 0, 0 },
...
};
For the "i" extension, 2.1.0 with different spec class are listed together.
This patch records the previous printed extension and version. If the
current extension and version are the same as the previous one, skip
printing.
bfd/
* elfxx-riscv.c (riscv_print_extensions): New function. Print
available extensions and versions.
* elfxx-riscv.h (riscv_print_extensions): New declaration.
gas/
* gas/config/tc-riscv.c (md_parse_option): Parse 'help' keyword in
-march option to print available extensions and versions.
* testsuite/gas/riscv/march-help.l: New testcase for -march=help.
* testsuite/gas/riscv/riscv.exp: Updated.
|
|
|
|
|