[PATCH v3] elf: Set p_align to the minimum page size if possible

Jan Beulich jbeulich@suse.com
Thu Feb 10 12:44:58 GMT 2022


On 14.01.2022 09:12, Jan Beulich wrote:
> On 29.12.2021 20:39, H.J. Lu via Binutils wrote:
>> --- /dev/null
>> +++ b/ld/testsuite/ld-elf/p_align-1.c
>> @@ -0,0 +1,25 @@
>> +#include <stdio.h>
>> +#include <stdint.h>
>> +#include <stdlib.h>
>> +
>> +#ifndef ALIGN
>> +# define ALIGN 0x800000
>> +#endif
>> +
>> +int
>> +__attribute__ ((weak))
>> +is_aligned (void *p, int align)
>> +{
>> +  return (((uintptr_t) p) & (align - 1)) == 0;
>> +}
>> +
>> +int foo __attribute__ ((aligned (ALIGN))) = 1;
> 
> Alongside newer distros I also continue to build and test binutils on an
> oldish one. gcc 4.3 looks to silently ignore[1] alignment values larger
> than 1Mb on at least 32-bit x86. Hence all 4 derived tests fail there. I
> think you want to verify that foo's alignment is actually 8Mb in the
> object file, or use an assembler source instead of a C one (albeit I can
> see that this would undermine your PIE / non-PIE test variants).

I have to admit that I find it disappointing that this and the later
reported failure on glibc 2.26 (or, as you were suggesting, an unpatched
kernel) have not been taken care of in time for 2.38. I understand that
I did not come back with results of testing your proposed workaround, but
as said in an earlier reply I don't view adding a gcc version dependency
as a viable workaround, let alone a fix. Hence I didn't see any basis for
putting time into testing that change.

Jan



More information about the Binutils mailing list