Page MenuHomePhabricator

[ASan] Tentative fix for 'non-ABS relocation R_386_GOTOFF' in 'debug_*'
AbandonedPublic

Authored by hctim on Dec 7 2020, 1:39 PM.

Details

Reviewers
pcc
MaskRay
Summary

Looks like GCC used to create non-PC relative relocations in debug
sections, which is invalid.

Seems like a well known problem:

Unfortunately some of the tests were recently flipped to -fuse-ld=lld,
and this broke the bots. This is a tentative fix for:

This should probably be fixed in LLD, to make LLD be permissive of
GOTOFF relocations like the GOTPC relocation fix upstream. However, it's
hard for me to test this as the earliest gcc I have access to is 8.4.0,
which doesn't seem to exhibit these problems.

Diff Detail

Unit TestsFailed

TimeTest
60 msx64 windows > LLVM.CodeGen/XCore::threads.ll
Script: -- : 'RUN: at line 1'; c:\ws\w64\llvm-project\premerge-checks\build\bin\llc.exe -march=xcore < C:\ws\w64\llvm-project\premerge-checks\llvm\test\CodeGen\XCore\threads.ll | c:\ws\w64\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w64\llvm-project\premerge-checks\llvm\test\CodeGen\XCore\threads.ll

Event Timeline

hctim requested review of this revision.Dec 7 2020, 1:39 PM
hctim created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2020, 1:39 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
hctim updated this revision to Diff 310010.Dec 7 2020, 1:41 PM

(update description)

hctim edited the summary of this revision. (Show Details)Dec 7 2020, 1:42 PM
MaskRay added a comment.EditedDec 7 2020, 2:17 PM

non-PC relative relocations in debug sections, which is invalid.

non-absolute relocations in debug sections, which is invalid

https://reviews.llvm.org/D43351

LLD worked around the R_386_GOTPC problem in D43351 but it seems that incorrect R_386_GOTOFF can be produced as well. It may or may not be the same as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630

As chatted offline, it'd be great to have a translation unit to exhibit the R_386_GOTPC in .rel.debug_* problem and follow up on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630 asking whether it has been fixed in a newer GCC 8 release.