[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/16858] weak external reference has wrong value
From: |
bernd.edlinger at hotmail dot de |
Subject: |
[Bug gas/16858] weak external reference has wrong value |
Date: |
Mon, 21 Apr 2014 16:21:16 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=16858
--- Comment #2 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 7557
--> https://sourceware.org/bugzilla/attachment.cgi?id=7557&action=edit
Assembler-Source where the bug was discovered
with objdump -d -r crtbegin.o we have wrong code:
f3: 83 ec 04 sub $0x4,%esp
f6: 85 c0 test %eax,%eax
f8: ba f0 ff ff ff mov $0xfffffff0,%edx
f9: dir32 ___deregister_frame_info
fd: 74 16 je 115 <___gcc_deregister_frame+0x35>
but the cygming-crtbegin.s looks correct:
LVL17:
.loc 1 158 0
testl %eax, %eax
.loc 1 162 0
movl $___deregister_frame_info, %edx
.loc 1 158 0
je L27
whenever there is a weak definition the reference is actually minus
the offset of the previous weak definition. Everything is OK if that was
at offset zero.
test case:
$ cat test.c
#include <stdio.h>
extern void test() __attribute__((weak));
int main()
{
printf("hello\n");
test();
return 0;
}
__attribute__((weak))
void test()
{
printf("weak\n");
}
$ cat test1.c
#include <stdio.h>
void test()
{
printf("strong\n");
}
$ gcc -o test test.c test1.c
$ ./test
hello
Segmentation fault (core dumped)
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/16858] New: weak external, bernd.edlinger at hotmail dot de, 2014/04/21
- [Bug gas/16858] weak external, bernd.edlinger at hotmail dot de, 2014/04/21
- [Bug gas/16858] weak external reference has wrong value, bernd.edlinger at hotmail dot de, 2014/04/21
- [Bug gas/16858] weak external reference has wrong value,
bernd.edlinger at hotmail dot de <=
- [Bug gas/16858] weak external reference has wrong value, address@hidden, 2014/04/21
- [Bug gas/16858] weak external reference has wrong value, mikpelinux at gmail dot com, 2014/04/21
- [Bug gas/16858] weak external reference has wrong value, mikpelinux at gmail dot com, 2014/04/23
- [Bug gas/16858] weak external reference has wrong value, nickc at redhat dot com, 2014/04/25
- [Bug gas/16858] weak external reference has wrong value, nickc at redhat dot com, 2014/04/25
- [Bug gas/16858] weak external reference has wrong value, mikpelinux at gmail dot com, 2014/04/27
- [Bug gas/16858] weak external reference has wrong value, cvs-commit at gcc dot gnu.org, 2014/04/28
- [Bug gas/16858] weak external reference has wrong value, nickc at redhat dot com, 2014/04/28
- [Bug gas/16858] weak external reference has wrong value, bernd.edlinger at hotmail dot de, 2014/04/29