Elfhack error when building with lld

RESOLVED FIXED in Firefox 57

Status

RESOLVED FIXED
a year ago
6 months ago

People

(Reporter: sylvestre, Assigned: glandium)

Tracking

(Blocks: 1 bug)

Trunk
mozilla57
Dependency tree / graph

Firefox Tracking Flags

(firefox57 fixed)

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(4 attachments, 2 obsolete attachments)

(Reporter)

Description

a year ago
===
=== If you get failures below, please file a bug describing the error
=== and your environment (compiler and linker versions), and use
=== --disable-elf-hack until this is fixed.
===
# Fail if the library doesn't have INIT_ARRAY .dynamic info
===
=== If you get failures below, please file a bug describing the error
readelf -d test-array.so | grep '(INIT_ARRAY)'
=== and your environment (compiler and linker versions), and use
=== --disable-elf-hack until this is fixed.
 0x0000000000000019 (INIT_ARRAY)         0xb000
===
# Fail if the library doesn't have INIT .dynamic info
/data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack/elfhack -b -f test-array.so
readelf -d test-ctors.so | grep '(INIT)'
test-array.so: Reduced by 8456 bytes
 0x000000000000000c (INIT)               0x8017
# Fail if the backup file doesn't exist
[ -f 'test-array.so.bak' ]
/data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack/elfhack -b -f test-ctors.so
# Fail if the new library doesn't contain less relocations
[ $(objdump -R test-array.so.bak | wc -l) -gt $(objdump -R test-array.so | wc -l) ]
test-ctors.so: Reduced by 8416 bytes
# Fail if the backup file doesn't exist
[ -f 'test-ctors.so.bak' ]
# Fail if the new library doesn't contain less relocations
[ $(objdump -R test-ctors.so.bak | wc -l) -gt $(objdump -R test-ctors.so | wc -l) ]
# Will either crash or return exit code 1 if elfhack is broken
LD_PRELOAD=/data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack/test-array.so /data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack/dummy
Segmentation fault
Makefile:50: recipe for target 'libs' failed

Compiler: clang 6.0 trunk (Debian Jessie)
Linker  : LLD 6.0 trunk

When using --disable-elf-hack everything is OK

Reproducible: Always
(Reporter)

Updated

a year ago
Blocks: 1384434
Can you attach the pre-elfhacked library?
Flags: needinfo?(sledru)
(Reporter)

Comment 2

a year ago
Created attachment 8892029 [details]
test-array.so
Flags: needinfo?(sledru)
(Reporter)

Comment 3

a year ago
Created attachment 8892030 [details]
test-ctors.so
(Reporter)

Comment 4

a year ago
Not 100% they are the "pre-elfhacked library"
(Reporter)

Updated

a year ago
Depends on: 1385910
(Reporter)

Comment 5

a year ago
Created attachment 8892064 [details]
test-array.so

Probably the one you want

Generated with:
jenkins@irill4:~/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack$  /usr/bin/clang++-6.0 -std=gnu++11 -Qunused-arguments   -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wno-gnu-zero-variadic-macro-arguments -Wformat-security -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-strict-aliasing -fno-rtti -fno-math-errno -pthread -pipe -fexceptions  -g -Os -fno-omit-frame-pointer  -Werror -fPIC -shared -Wl,-z,defs -Wl,-h,test-array.so -o test-array.so -lpthread  -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id   -fuse-ld=lld  -Wl,-rpath-link,/data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/usr/local/lib  -fcolor-diagnostics test-array.o -nostartfiles
Attachment #8892029 - Attachment is obsolete: true
(Reporter)

Comment 6

a year ago
Created attachment 8892065 [details]
test-ctors.so

jenkins@irill4:~/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/build/unix/elfhack$  /usr/bin/clang++-6.0 -std=gnu++11 -Qunused-arguments   -Qunused-arguments -Wall -Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wloop-analysis -Wc++11-compat-pedantic -Wc++14-compat -Wc++14-compat-pedantic -Wc++1z-compat -Wcomma -Wimplicit-fallthrough -Werror=non-literal-null-conversion -Wstring-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wformat -Wno-gnu-zero-variadic-macro-arguments -Wformat-security -Wno-unknown-warning-option -Wno-return-type-c-linkage -fno-strict-aliasing -fno-rtti -fno-math-errno -pthread -pipe -fexceptions  -g -Os -fno-omit-frame-pointer  -Werror -fPIC -shared -Wl,-z,defs -Wl,-h,test-ctors.so -o test-ctors.so -lpthread  -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,--build-id   -fuse-ld=lld  -Wl,-rpath-link,/data/jenkins/workspace/firefox-clang-lld-last/obj-x86_64-pc-linux-gnu/dist/bin -Wl,-rpath-link,/usr/local/lib  -fcolor-diagnostics test-ctors.o -nostartfiles
Attachment #8892030 - Attachment is obsolete: true
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Reporter)

Updated

a year ago
Assignee: nobody → mh+mozilla

Comment 9

a year ago
mozreview-review
Comment on attachment 8892769 [details]
Bug 1385783 - Don't assume both elfhack sections are next to each other.

https://reviewboard.mozilla.org/r/163744/#review169332

This patch looks pretty non-controversial, even if the try push looks pretty busted.
Attachment #8892769 - Flags: review?(nfroyd) → review+

Comment 10

a year ago
mozreview-review
Comment on attachment 8892770 [details]
Bug 1385783 - Insert the elfhack code before the first executable section.

https://reviewboard.mozilla.org/r/163746/#review169334

r- for the try push red.
Attachment #8892770 - Flags: review?(nfroyd) → review-
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)

Comment 13

a year ago
mozreview-review
Comment on attachment 8892770 [details]
Bug 1385783 - Insert the elfhack code before the first executable section.

https://reviewboard.mozilla.org/r/163746/#review169872
Attachment #8892770 - Flags: review?(nfroyd) → review+

Comment 14

a year ago
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/bd0ea10b4001
Don't assume both elfhack sections are next to each other. r=froydnj
https://hg.mozilla.org/integration/autoland/rev/46a4358a2266
Insert the elfhack code before the first executable section. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/bd0ea10b4001
https://hg.mozilla.org/mozilla-central/rev/46a4358a2266
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox57: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
(Reporter)

Updated

a year ago
Blocks: 1388713
(Assignee)

Updated

8 months ago
Depends on: 1423813
(Assignee)

Updated

8 months ago
Depends on: 1423821
(Assignee)

Updated

8 months ago
Depends on: 1423822

Updated

6 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.