[Bug ld/27433] RISC-V linker might lose relax opportunities since "again" doesn't work as expected
https://sourceware.org/bugzilla/show_bug.cgi?id=27433 --- Comment #5 from Nelson Chu --- Oh I forgot to add the PR27433 in the comment, so it doesn’t show which commit fixes this PR. commit ebdcad3fddf6ec21f6d4dcc702379a12718cf0c4 Refs: [master], {upstream-write/master}, users/ARM/embedded-gdb-master-2018q4-9197-gebdcad3 Author: Nelson Chu AuthorDate: Fri Dec 18 10:59:41 2020 +0800 Commit: Nelson Chu CommitDate: Thu Mar 11 17:27:13 2021 +0800 RISC-V: Improve multiple relax passes problem. (In reply to Jim Wilson from comment #4) > I don't see another target that does the same thing, but I do see multiple > targets with size_stub hooks that can call ldelf_map_segments multiple > times, so clearly this should work. > > Worst case, we could always increase the relax pass count. We could have 7 > passes instead of 4 for instance, where 0, 1, 2 are the same as current > passes, then 3, 4, 5 as same as 0, 1, 2 if necessary, and then pass 7 is > same as current pass 3 for alignment relaxation. But I don't think that is > necessary. Your patch should work. Thanks for clarifying these. > I noticed a few minor comment typos > itslef -> itself > relxations -> relaxations > and from a previous patch that I missed > obselete -> obsolete Fixed! > I'm curious how this affects link time, but since few relaxations will happen > on the second time through I don't think it will matter much. I can check > native glibc build times after you commit the patch. I have ran and passed the toolchain regressions again, so the patch is committed for now. Thanks! -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/27565] New: ld: Support input section description keyword: REVERSE
https://sourceware.org/bugzilla/show_bug.cgi?id=27565 Bug ID: 27565 Summary: ld: Support input section description keyword: REVERSE Product: binutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: i at maskray dot me Target Milestone: --- REVERSE complements SORT, e.g. SECTIONS { .aaa : { *(REVERSE(SORT_BY_NAME(.aaa.*))) } } If the user wants to detect some static initialization order fiasco issues, they can specify: # If https://sourceware.org/bugzilla/show_bug.cgi?id=26404 is supported, # the user can provide a fragment instead of a full linker script .init_array : { *(SORT_BY_INIT_PRIORITY(REVERSE(.init_array.* .ctors.*))) *(REVERSE(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) } which runs static constructors in a reversed order. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/27566] New: [RISC-V] relocation truncated to fit: R_RISCV_GPREL_I against aymbol
https://sourceware.org/bugzilla/show_bug.cgi?id=27566 Bug ID: 27566 Summary: [RISC-V] relocation truncated to fit: R_RISCV_GPREL_I against aymbol Product: binutils Version: 2.36 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: lifang_...@c-sky.com Target Milestone: --- Here is case(It is not the orignal case, the original is that gp can't get the .LANCHOR. I made this case simpler.): === .option nopic .section.rodata .align 10 .Lpadding0: .zero 0x10 .section.rodata .align 3 .globl hello_rodata .set hello_rodata, . + 0x1800 .Lpadding: .zero 128 .section .init_array .type padding_init_array, @object .size padding_init_array, 0x100 .globl padding_init_array padding_init_array: .zero 0x100 .text .align 1 .globl main .type main, @function main: lui a5,%hi(hello_rodata) addia5,a5,%lo(hello_rodata) .size main, .-main The binutils commit: ebdcad3fddf6ec21f6d4dcc702379a12718cf0c4 config: "../configure --target=riscv64-unknown-linux target_alias=riscv64-unknown-linux" build case ./gas/as-new -o a.o a.s ./ld/ld-new -z relro -o a a.o -e main = In this case, the gp can access hello_rodata while relaxing. But the symbols defined after ". = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));"(link file) may be increased with the paddings when finishing lang_size_relro_segment. And the gp may not accessing the symbols. In my opinion, if the symbol is not defined in data segment(between ". = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));" and ". = DATA_SEGMENT_END (.);"), it should not convert to GPREL_I when linking with "-z relro" -- You are receiving this mail because: You are on the CC list for the bug.