This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: PR 68913: Provide weak version of __fread_chk for PR61886 test
- From: Dominique d'HumiÃres <dominiq at lps dot ens dot fr>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Jan 2016 15:05:03 +0100
- Subject: Re: RFA: PR 68913: Provide weak version of __fread_chk for PR61886 test
- Authentication-results: sourceware.org; auth=none
- References: <E1A1F047-8B8B-44B0-BA96-64C2C5529FD0 at lps dot ens dot fr> <568E6F8C dot 10006 at redhat dot com>
> Le 7 janv. 2016 Ã 15:00, Nick Clifton <nickc@redhat.com> a Ãcrit :
>
> Hi Dominique,
>
> On 07/01/16 13:42, Dominique d'HumiÃres wrote:
>>> +/* { dg-lto-options { { -flto -O2 -Werror -Wl,--defsym,__fread_chk=0x1234 } } } */
>>
>> This wonât work on darwin:
>>
>> ld: unknown option: --defsym
>> collect2: error: ld returned 1 exit status
>
> Oh bananas.
>
> Does the pr61886 test work on Darwin without any changes ? If it fails then is there a Darwin linker command line option to define a symbol ?
No:
Executing on host: /opt/gcc/build_w/gcc/xgcc -B/opt/gcc/build_w/gcc/ c_lto_pr61886_0.o -m64 -fno-diagnostics-show-caret -fdiagnostics-color=never -flto -O2 -Werror -o gcc-dg-lto-pr61886-01.exe (timeout = 300)
spawn -ignore SIGHUP /opt/gcc/build_w/gcc/xgcc -B/opt/gcc/build_w/gcc/ c_lto_pr61886_0.o -m64 -fno-diagnostics-show-caret -fdiagnostics-color=never -flto -O2 -Werror -o gcc-dg-lto-pr61886-01.exe
Undefined symbols for architecture x86_64:
"__fread_chk", referenced from:
_main in c_lto_pr61886_0.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
compiler exited with status 1
Dominique
> This revised version of the patch works for me, but I do not have a Darwin native system on which I can test it. Would you be able to try it out for me ?
>
> Cheers
> Nick
>
>
> Index: gcc/testsuite/gcc.dg/lto/pr61886_0.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/lto/pr61886_0.c (revision 232123)
> +++ gcc/testsuite/gcc.dg/lto/pr61886_0.c (working copy)
> @@ -1,5 +1,6 @@
> /* { dg-lto-do link } */
> /* { dg-lto-options { { -flto -O2 -Werror } } } */
> +/* { dg-extra-ld-options "-Wl,--defsym,__fread_chk=0x1234" { target { ! { *-*-darwin* } } } } */
>
> typedef __SIZE_TYPE__ size_t;
> typedef struct _IO_FILE FILE;