[Bug binutils/28689] p_align in ELF program headers should not exceed section alignment
https://sourceware.org/bugzilla/show_bug.cgi?id=28689 --- Comment #7 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74e315dbfe5200c473b226e937935fb8ce391489 commit 74e315dbfe5200c473b226e937935fb8ce391489 Author: H.J. Lu Date: Mon Dec 13 19:46:04 2021 -0800 elf: Set p_align to the minimum page size if possible Currently, on 32-bit and 64-bit ARM, it seems that ld generates p_align values of 0x1 even if no section alignment is greater than 0x1000. The issue is more general and probably affects other targets with multiple page sizes. While file layout absolutely must take 64K page size into account, that does not have to be reflected in the p_align value. If running on a 64K kernel, the file will be loaded at a 64K page boundary by necessity. On a 4K kernel, 64K alignment is not needed. The glibc loader has been fixed to honor p_align: https://sourceware.org/bugzilla/show_bug.cgi?id=28676 similar to kernel: commit ce81bb256a224259ab686742a6284930cbe4f1fa Author: Chris Kennelly Date: Thu Oct 15 20:12:32 2020 -0700 fs/binfmt_elf: use PT_LOAD p_align values for suitable start address This means that on 4K kernels, we will start to do extra work for 64K p_align, but this pointless for pretty much all binaries (whose section alignment rarely exceeds 16). The minimum page size is used, instead of the maximum section alignment due to this glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28688 It has been fixed in glibc 2.35. But linker output must work on existing glibc binaries. 1. Set p_align to the minimum page size while laying out segments aligning to the maximum page size or section alignment. The run-time loader can align segments to the minimum page size or above, depending on system page size. 2. If -z max-page-size=NNN is used, p_align will be set to the maximum page size or the largest section alignment. 3. If a section requires alignment higher than the minimum page size, don't set p_align to the minimum page size. 4. If a section requires alignment higher than the maximum page size, set p_align to the section alignment. 5. For objcopy, when the minimum page size != the maximum page size, p_align may be set to the minimum page size while segments are aligned to the maximum page size. In this case, the input p_align will be ignored and the maximum page size will be used to align the ouput segments. 6. Update linker to disallow the common page size > the maximum page size. 7. Update linker to avoid the common page size > the maximum page size. 8. Adjust pru_irq_map-1.d to expect p_align == sh_addralign: Section Headers: [Nr] Name TypeAddr OffSize ES Flg Lk Inf Al [ 0]NULL 00 00 00 0 0 0 [ 1] .text PROGBITS2000 7c 04 00 AX 0 0 4 ... Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x74 0x 0x 0x8 0x8 RW 0x1 LOAD 0x7c 0x2000 0x2000 0x4 0x4 R E 0x4 vs. Section Headers: [Nr] Name TypeAddr OffSize ES Flg Lk Inf Al [ 0]NULL 00 00 00 0 0 0 [ 1] .text PROGBITS2000 7c 04 00 AX 0 0 4 ... Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x74 0x 0x 0x8 0x8 RW 0x1 LOAD 0x7c 0x2000 0x2000 0x4 0x4 R E 0x1 To enable this linker optimization, the backend should define ELF_P_ALIGN to ELF_MINPAGESIZE. bfd/ PR ld/28689 PR ld/28695 * elf-bfd.h (elf_backend_data): Add p_align. * elf.c (assign_file_positions_for_load_sections): Set p_align to the default p_align value while laying out segments aligning to maximum page size or section alignment. (elf_is_p_align_valid): New function. (copy_elf_program_header): Call elf_is_p_align_valid to determine if p_align is valid. * elfxx-target.h (ELF_P_ALIGN): New. Default to 0. (elfNN_bed): Add ELF_P_ALIGN. * elfxx-x86.h (ELF_P_ALIGN): New. Set to ELF_MINPAGESIZE. include/ PR ld/28689 PR ld/28695 * bfdlink.h (bfd_link_info): Add maxpagesize_is_set. ld/ PR ld/28689 PR ld/28695 * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Set link_info.maxpagesize_is_set for -z max-page-size=NNN. * ldelf.c (ldelf_afte
[Bug binutils/28689] p_align in ELF program headers should not exceed section alignment
https://sourceware.org/bugzilla/show_bug.cgi?id=28689 H.J. Lu changed: What|Removed |Added Version|unspecified |2.38 (HEAD) --- Comment #8 from H.J. Lu --- Fixed for x86 in binutils 2.38. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/28722] Vague linker error message for bad thin archive
https://sourceware.org/bugzilla/show_bug.cgi?id=28722 H.J. Lu changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED Target Milestone|--- |2.38 --- Comment #2 from H.J. Lu --- Fixed for 2.38. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/28695] Linker doesn't warn p_align < sh_addralign
https://sourceware.org/bugzilla/show_bug.cgi?id=28695 H.J. Lu changed: What|Removed |Added Resolution|--- |FIXED Target Milestone|--- |2.38 Status|NEW |RESOLVED See Also||https://sourceware.org/bugz ||illa/show_bug.cgi?id=28676 --- Comment #2 from H.J. Lu --- Fixed in binutils 2.38. ld will set the proper p_align. Also need the glibc fix: PR 28676. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/28695] Linker doesn't warn p_align < sh_addralign
https://sourceware.org/bugzilla/show_bug.cgi?id=28695 --- Comment #1 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74e315dbfe5200c473b226e937935fb8ce391489 commit 74e315dbfe5200c473b226e937935fb8ce391489 Author: H.J. Lu Date: Mon Dec 13 19:46:04 2021 -0800 elf: Set p_align to the minimum page size if possible Currently, on 32-bit and 64-bit ARM, it seems that ld generates p_align values of 0x1 even if no section alignment is greater than 0x1000. The issue is more general and probably affects other targets with multiple page sizes. While file layout absolutely must take 64K page size into account, that does not have to be reflected in the p_align value. If running on a 64K kernel, the file will be loaded at a 64K page boundary by necessity. On a 4K kernel, 64K alignment is not needed. The glibc loader has been fixed to honor p_align: https://sourceware.org/bugzilla/show_bug.cgi?id=28676 similar to kernel: commit ce81bb256a224259ab686742a6284930cbe4f1fa Author: Chris Kennelly Date: Thu Oct 15 20:12:32 2020 -0700 fs/binfmt_elf: use PT_LOAD p_align values for suitable start address This means that on 4K kernels, we will start to do extra work for 64K p_align, but this pointless for pretty much all binaries (whose section alignment rarely exceeds 16). The minimum page size is used, instead of the maximum section alignment due to this glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28688 It has been fixed in glibc 2.35. But linker output must work on existing glibc binaries. 1. Set p_align to the minimum page size while laying out segments aligning to the maximum page size or section alignment. The run-time loader can align segments to the minimum page size or above, depending on system page size. 2. If -z max-page-size=NNN is used, p_align will be set to the maximum page size or the largest section alignment. 3. If a section requires alignment higher than the minimum page size, don't set p_align to the minimum page size. 4. If a section requires alignment higher than the maximum page size, set p_align to the section alignment. 5. For objcopy, when the minimum page size != the maximum page size, p_align may be set to the minimum page size while segments are aligned to the maximum page size. In this case, the input p_align will be ignored and the maximum page size will be used to align the ouput segments. 6. Update linker to disallow the common page size > the maximum page size. 7. Update linker to avoid the common page size > the maximum page size. 8. Adjust pru_irq_map-1.d to expect p_align == sh_addralign: Section Headers: [Nr] Name TypeAddr OffSize ES Flg Lk Inf Al [ 0]NULL 00 00 00 0 0 0 [ 1] .text PROGBITS2000 7c 04 00 AX 0 0 4 ... Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x74 0x 0x 0x8 0x8 RW 0x1 LOAD 0x7c 0x2000 0x2000 0x4 0x4 R E 0x4 vs. Section Headers: [Nr] Name TypeAddr OffSize ES Flg Lk Inf Al [ 0]NULL 00 00 00 0 0 0 [ 1] .text PROGBITS2000 7c 04 00 AX 0 0 4 ... Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x74 0x 0x 0x8 0x8 RW 0x1 LOAD 0x7c 0x2000 0x2000 0x4 0x4 R E 0x1 To enable this linker optimization, the backend should define ELF_P_ALIGN to ELF_MINPAGESIZE. bfd/ PR ld/28689 PR ld/28695 * elf-bfd.h (elf_backend_data): Add p_align. * elf.c (assign_file_positions_for_load_sections): Set p_align to the default p_align value while laying out segments aligning to maximum page size or section alignment. (elf_is_p_align_valid): New function. (copy_elf_program_header): Call elf_is_p_align_valid to determine if p_align is valid. * elfxx-target.h (ELF_P_ALIGN): New. Default to 0. (elfNN_bed): Add ELF_P_ALIGN. * elfxx-x86.h (ELF_P_ALIGN): New. Set to ELF_MINPAGESIZE. include/ PR ld/28689 PR ld/28695 * bfdlink.h (bfd_link_info): Add maxpagesize_is_set. ld/ PR ld/28689 PR ld/28695 * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Set link_info.maxpagesize_is_set for -z max-page-size=NNN. * ldelf.c (ldelf_afte
[Bug binutils/28747] New: objdump manual misspells frames-interp
https://sourceware.org/bugzilla/show_bug.cgi?id=28747 Bug ID: 28747 Summary: objdump manual misspells frames-interp Product: binutils Version: 2.36.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: m101010a at gmail dot com Target Milestone: --- The list of dwarf options in the objdump manual lists "frame-interp" as an option, but the actual option name is "frames-interp" -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/28747] objdump manual misspells frames-interp
https://sourceware.org/bugzilla/show_bug.cgi?id=28747 --- Comment #1 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8acecab0b0e11e1e0763302daa9766f85084737e commit 8acecab0b0e11e1e0763302daa9766f85084737e Author: H.J. Lu Date: Wed Jan 5 11:51:40 2022 -0800 doc: Replace =frame-interp with =frames-interp The actual objdump and readelf option name is =frames-interp, not =frames-interp. PR binutils/28747 * doc/debug.options.texi: Replace =frame-interp with =frames-interp. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/28747] objdump manual misspells frames-interp
https://sourceware.org/bugzilla/show_bug.cgi?id=28747 H.J. Lu changed: What|Removed |Added Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Target Milestone|--- |2.38 --- Comment #2 from H.J. Lu --- Fixed for 2.38. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gold/28750] Gold linker simply does not work for mips64-linux-gnu.
https://sourceware.org/bugzilla/show_bug.cgi?id=28750 cqwrteur changed: What|Removed |Added Build||x86_64-linux-gnu Host||x86_64-w64-mingw32 Target||mips64-linux-gnu -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gold/28750] New: Gold linker simply does not work for mips64-linux-gnu.
https://sourceware.org/bugzilla/show_bug.cgi?id=28750 Bug ID: 28750 Summary: Gold linker simply does not work for mips64-linux-gnu. Product: binutils Version: 2.38 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: euloanty at live dot com CC: ian at airs dot com Target Milestone: --- Created attachment 13893 --> https://sourceware.org/bugzilla/attachment.cgi?id=13893&action=edit error message D:\hg\fast_io\examples\0001.helloworld>mips64-linux-gnu-g++ -o helloworld_mips32 helloworld.cc -Ofast -std=c++23 -s -flto -I../../include -mabi=64 -fuse-ld=gold d:/x86_64-windows-gnu/mips64-linux-gnu/bin/../lib/gcc/mips64-linux-gnu/12.0.0/../../../../mips64-linux-gnu/bin/ld.gold.exe: warning: Invalid DIE in debug info; failed to reduce debug info d:/x86_64-windows-gnu/mips64-linux-gnu/bin/../lib/gcc/mips64-linux-gnu/12.0.0/../../../../mips64-linux-gnu/bin/ld.gold.exe: internal error in finalize_data_size, at ../../../../../binutils-gdb/gold/output.h:355 collect2.exe: error: ld returned 1 exit status -- You are receiving this mail because: You are on the CC list for the bug.
[Bug gold/28750] Gold linker simply does not work for mips64-linux-gnu.
https://sourceware.org/bugzilla/show_bug.cgi?id=28750 cqwrteur changed: What|Removed |Added CC||euloanty at live dot com -- You are receiving this mail because: You are on the CC list for the bug.