Message ID | 568FA50C.9070601@redhat.com |
---|---|
State | New |
Headers | show |
On 01/08/2016 05:01 AM, Nick Clifton wrote: > Hi Guys, > > OK - how about this reformulation of the pr61886 test ? > > The patch changes references to __fread_chk with references to just > fread, which I assume will be present in all target runtime libraries. I > had to add some preprocessor trickery in order to ensure that > __USER_LABEL_PREFIX__ is correctly prepended to the assembler name of > the functions, but other than that the test remains the same. No linker > funny business this time. > > I have tested this patch with an x86_64 native (whose C runtime does > include __fread_chk), an ARM cross compiler (using newlib, which does > not provide __fread_chk) and with a V850 cross compiler (which uses > newlib and which also defines __USER_LABEL_PREFIX to "_"). Prior to > Honza's r231548 patch all three toolchains fail this patched test. Using > today#s latest and greatest mainline gcc sources, all three toolchains > pass the patched test. > > OK to apply ? > > Cheers > Nick > > gcc/testsuite/ChangeLog > 2016-01-08 Nick Clifton <nickc@redhat.com> > > PR target/68913 > * gcc.dg/lto/pr61886_0.c: Rename the external function called > to fread so that it will be found in all target runtimes. Ok. Thanks for going the extra mile on this one. jeff
Index: gcc/testsuite/gcc.dg/lto/pr61886_0.c =================================================================== --- gcc/testsuite/gcc.dg/lto/pr61886_0.c (revision 232157) +++ gcc/testsuite/gcc.dg/lto/pr61886_0.c (working copy) @@ -4,12 +4,15 @@ typedef __SIZE_TYPE__ size_t; typedef struct _IO_FILE FILE; -extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk") __attribute__ ((__warn_unused_result__)); -extern size_t __fread_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk") __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread called with bigger size * nmemb than length " "of destination buffer"))); +#define STRING1(a) #a +#define STRING2(a) STRING1(a) +extern size_t fread (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ (STRING2(__USER_LABEL_PREFIX__) "fread") __attribute__