https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
Bug ID: 98946 Summary: GCC generating incorrect relocation R_386_GOTOFF in .debug-info for x86 (32) Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: manojgupta at google dot com Target Milestone: --- Created attachment 50116 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50116&action=edit pre-processed files and gcc command limes This might be related to an older bug 82630 that fixed a similar issue for R_386_GOTPC relocations. Chromium OS bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1171829 We are hitting a similar problem when upgrading to GCC 10.2.1 in Chrome OS. the affected files are in glibc 2.27 where the presence of R_386_GOTOFF is causing LLD linker to complain. This is breaking static linking on 32-bit for us. The errors look like: ld.lld: error: dl-close.c:(.debug_info+0x1E6A): has non-ABS relocation R_386_GOTOFF against symbol '.LC3' ld.lld: error: dl-profile.c:(.debug_info+0x1A7C): has non-ABS relocation R_386_GOTOFF against symbol '.LC4' ld.lld: error: dl-lookup.c:(.debug_info+0x23FA): has non-ABS relocation R_386_GOTOFF against symbol '.LC8' ld.lld: error: dl-reloc.c:(.debug_info+0x3555): has non-ABS relocation R_386_GOTOFF against symbol '.LC7' ld.lld: error: dl-load.c:(.debug_info+0x1B1C): has non-ABS relocation R_386_GOTOFF against symbol '.LC65' ld.lld: error: malloc.c:(.debug_info+0x28D5): has non-ABS relocation R_386_GOTOFF against symbol '.LC2' ld.lld: error: plural.c:(.debug_loc+0xFA4): has non-ABS relocation R_386_GOTOFF against symbol 'yyr2' It was suggested on the bug by Fangrui who is our LLD expert that this might be a GCC bug. "Relocations from .debug_info referencing .text.* can only be absolute relocation types or DTPREL (TLS)-like." There was a previous fix for a similar bug: https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=6b10f1741a1d79c9e32e8790fb98ba93c864b219 . Maybe the fix needs to be extended to handle the R_386_GOTOFF relocations. I am attaching one of the files LLD is complaining (dl-close.c) with intermediate steps and output of "-v" command line. The assembler being used is GNU assembler 2.35.1. Please let me know if more information is needed.