Closed Bug 1385783 Opened 7 years ago Closed 7 years ago

Elfhack error when building with lld

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: Sylvestre, Assigned: glandium)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 2 obsolete files)

===
=== 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
Blocks: linker-lld
Can you attach the pre-elfhacked library?
Flags: needinfo?(sledru)
Attached file test-array.so (obsolete) —
Flags: needinfo?(sledru)
Attached file test-ctors.so (obsolete) —
Not 100% they are the "pre-elfhacked library"
Depends on: 1385910
Attached file 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
Attached file 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
Assignee: nobody → mh+mozilla
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 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 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+
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
Blocks: 1388713
Depends on: 1388893
Depends on: 1423813
Depends on: 1423821
Depends on: 1423822
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: