[V2 01/36] [SFrame-V3] readelf: testsuite: sframe: add new SFrame V2 test
Indu Bhagat
indu.bhagat@oracle.com
Fri Jan 9 23:40:51 GMT 2026
On 1/9/26 6:35 AM, Jan Beulich wrote:
> On 09.01.2026 15:31, Jan Beulich wrote:
>> On 07.01.2026 09:41, Indu Bhagat via Binutils wrote:
>>> --- /dev/null
>>> +++ b/binutils/testsuite/binutils-all/x86-64/README-sframe-tests
>>> @@ -0,0 +1,53 @@
>>> +The tests in sframe.exp use binary data files:
>>> + - test-v2-ET_EXEC.sframe.bz2
>>> + - test-v2-ET_REL.sframe.bz2
>>> +These files are generated using a as/ld supporting SFrame V2 sections (Binutils
>>> +<= 2.45). The purpose of those tests is to make sure readelf/objdump support
>>> +works for SFrame V2.
>>
>> Well, yes, just that ...
>>
>>> +The binary files are generated using the following steps.
>>> +
>>> +$ cat fake_sort.c
>>> +/* Keep noinline to ensure a separate FDE is generated */
>>> +void __attribute__ ((noinline))
>>> +swapit (int *a, int *b)
>>> +{
>>> + *a = *b;
>>> +}
>>> +
>>> +void fake_sort (int *a, int n)
>>> +{
>>> + if (n > 0)
>>> + swapit (&a[0], &a[n-1]);
>>> +}
>>> +
>>> +$ cat sort.c
>>> +#include <stdio.h>
>>> +
>>> +#define ARRAY_LEN 128
>>> +
>>> +void fake_sort (int *a, int n);
>>> +
>>> +void sort_array (void)
>>> +{
>>> + volatile int data[ARRAY_LEN];
>>> + fake_sort ((int *)data, ARRAY_LEN);
>>> +}
>>> +
>>> +int main (void)
>>> +{
>>> + sort_array ();
>>> + /* for plt. */
>>> + printf ("done");
>>> + return 0;
>>> +}
>>> +
>>> +$ gcc -c sort.c -O2 -Wa,--gsframe
>>> +$ gcc -c fake_sort.c -O2 -Wa,--gsframe
>>> +$ gcc sort.o fake_sort.o -o sort -O2 -Wa,--gsframe
>>> +
>>> +$ objcopy --dump-section .sframe=test-v2-ET_EXEC.sframe sort
>>> +$ bzip2 test-v2-ET_EXEC.sframe
>>> +
>>> +$ objcopy --dump-section .sframe=test-v2-ET_REL.sframe sort.o
>>> +$ bzip2 test-v2-ET_REL.sframe
>>
>> ... nothing here uses as or ld. Which as / ld gcc uses people can't normally
>> control (easily). In a couple of years time (the latest) these instructions
>> will therefore more only partly helpful, as many people will then use too new
>> a gcc.
>
> Maybe I should be yet more explicit: What I was expecting are instructions how
> to re-create the _exact_ .bz2 files that you intend to put into the repo. That
> is what I would usually want to do before making changes, just to be sure I
> won't change more than intended. Imo that's going to be achievable only if you
> work from assembly files as sources, or else you force people to have access
> to one very specific version of gcc.
>
Makes sense. I have adapted the patch to use files generated from
assembly file as source for both x86_64 and s390x with instructions to
generate looking like so:
$ as --gsframe -o sort.o sort.s
$ ld -lc sort.o -o sort
$ cp sort test-v2-ET_EXEC.sframe
$ chmod -x test-v2-ET_EXEC.sframe
$ bzip2 test-v2-ET_EXEC.sframe
$ cp sort.o test-v2-ET_REL.sframe
$ bzip2 test-v2-ET_REL.sframe
Thanks
More information about the Binutils
mailing list