Bug 236506 - [CMake] REGRESSION(r289611): Debug builds fail linking binaries with ld.lld
Summary: [CMake] REGRESSION(r289611): Debug builds fail linking binaries with ld.lld
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-11 07:15 PST by Adrian Perez
Modified: 2022-02-21 08:00 PST (History)
10 users (show)

See Also:


Attachments
Patch (4.61 KB, patch)
2022-02-11 07:27 PST, Adrian Perez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch v2 (4.61 KB, patch)
2022-02-11 07:32 PST, Adrian Perez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch v3 (2.84 KB, patch)
2022-02-11 07:58 PST, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2022-02-11 07:15:06 PST
SSIA, build failures can be seen e.g. in the WPE x86_64 debug build bot:

  https://build.webkit.org/#/builders/66/builds/7690

Error message follows:


ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o
>>> referenced by ThunkGenerators.cpp:886 (/app/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp:886)
>>>               Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o:(JSC::expWrapper)                                                                                                                                                                                                                                                              ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output               >>> defined in Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o                                                              >>> referenced by ThunkGenerators.cpp:886 (/app/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp:886)                                                                                                            >>>               Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o:(JSC::logWrapper)
ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o
>>> referenced by ThunkGenerators.cpp:886 (/app/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp:886)
>>>               Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o:(JSC::floorWrapper)

ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o
>>> referenced by ThunkGenerators.cpp:886 (/app/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp:886)
>>>               Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o:(JSC::ceilWrapper)

ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o
>>> referenced by ThunkGenerators.cpp:886 (/app/webkit/Source/JavaScriptCore/jit/ThunkGenerators.cpp:886)
>>>               Source/JavaScriptCore/CMakeFiles/JavaScriptCore.dir/./__/__/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-8.cpp.o:(JSC::truncWrapper)
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Comment 1 Adrian Perez 2022-02-11 07:27:49 PST
Created attachment 451691 [details]
Patch
Comment 2 Adrian Perez 2022-02-11 07:32:42 PST
Created attachment 451693 [details]
Patch v2

Removes the leading dot from the section name,
hopefully that will make the EWS for Apple ports happier.
Comment 3 Adrian Perez 2022-02-11 07:37:03 PST
By the way, I think this is an interesting example about how LLD having
slightly stricter defaults ended up uncovering an issue in the code =)
Comment 4 Adrian Perez 2022-02-11 07:52:52 PST
(In reply to Adrian Perez from comment #2)
> Created attachment 451693 [details]
> Patch v2
> 
> Removes the leading dot from the section name,
> hopefully that will make the EWS for Apple ports happier.

Gah! Neither GNU toolchains nor Apple's like “.pushsection text”. I wanted
to use pushsection/popsection because the assembler (the GNU one at least)
sanity-checks that a push has a corresponding pop, and it would be neat to
have that; but it will be more portable to use .text/.previous instead.
Comment 5 Adrian Perez 2022-02-11 07:58:25 PST
Created attachment 451697 [details]
Patch v3


This version of the patch uses .previous to undo the effect of the .text
directives. The net result is the same as .pushsection/.popsection, but
the source is more portable.
Comment 6 EWS 2022-02-12 07:49:12 PST
Committed r289695 (247180@main): <https://commits.webkit.org/247180@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 451697 [details].
Comment 7 Radar WebKit Bug Importer 2022-02-12 07:50:19 PST
<rdar://problem/88855880>