Closed Bug 1391183 Opened 7 years ago Closed 7 years ago

lld - dummy binary with the elfhack segsfaults - try 2

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox57 affected)

VERIFIED FIXED
Tracking Status
firefox57 --- affected

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files)

follow up of Bug #1388713

Thanks to bug 1385783, the hack no longer fails.

This command is segfaulting:
$ 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 (core dumped)

core dump as attachment (debian 64b)
Attached file test-array.so
Attached file dummy
Here's what main looks like in that dummy:
00000000002010f8 <main>:
  2010f8:	31 c0                	xor    %eax,%eax
  2010fa:	e9 01 ef df ff       	jmpq   0
  2010ff:	cc                   	int3   

Here's what it's expected to look like:
00000000000006e0 <main>:
 6e0:	55                   	push   %rbp
 6e1:	48 89 e5             	mov    %rsp,%rbp
 6e4:	b8 00 00 00 00       	mov    $0x0,%eax
 6e9:	e8 b2 fe ff ff       	callq  5a0 <print_status@plt>
 6ee:	5d                   	pop    %rbp
 6ef:	c3                   	retq   

And dummy.c is:
extern __attribute__((visibility("default"), weak)) int print_status();

int main() {
    return print_status();
}

This is what objdump -dr dummy.o looks like on my machine:
0000000000000000 <main>:
   0:	55                   	push   %rbp
   1:	48 89 e5             	mov    %rsp,%rbp
   4:	b8 00 00 00 00       	mov    $0x0,%eax
   9:	e8 00 00 00 00       	callq  e <main+0xe>
			a: R_X86_64_PLT32	print_status-0x4
   e:	5d                   	pop    %rbp
   f:	c3                   	retq   

And what it looks like on yours:
0000000000000000 <main>:
   0:	31 c0                	xor    %eax,%eax
   2:	e9 00 00 00 00       	jmpq   7 <main+0x7>
			3: R_X86_64_PLT32	print_status-0x4

The code is fine, but lld is completely dropping the weak symbol.
Did you file an LLD bug, Sylvestre?
Flags: needinfo?(sledru)
Thank you!
I am in touch with upstream, they are working on it. ETA end of the week.
Depends on: 1401005
Merged upstream:
https://reviews.llvm.org/D37837
I retriggered the build with a correct version, the error message changed but still failing.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
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: