Page MenuHomePhabricator

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

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



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

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

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

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 asking whether it has been fixed in a newer GCC 8 release.