[PATCH] Remove fno-unit-at-a-time make variable
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Mar 31 11:33:24 GMT 2022
On 31/03/2022 00:43, Fangrui Song wrote:
> On 2022-03-30, Adhemerval Zanella wrote:
>>
>>
>> On 30/03/2022 13:23, Fangrui Song wrote:
>>> On 2022-03-30, Adhemerval Zanella wrote:
>>>>
>>>>
>>>> On 30/03/2022 02:07, Fangrui Song wrote:
>>>>> 795985e4e751 in 2003 added -fno-unit-at-a-time to errlist.c and
>>>>> siglist.c to "avoid reordering assembler output". -fno-toplevel-reorder
>>>>> is a rough replacement for this legacy option
>>>>> (https://sourceware.org/pipermail/gcc-patches/2006-January/186801.html).
>>>>>
>>>>> The reordering requirement does not seem to be needed any longer.
>>>>
>>>> We still need them for otherwise DEFINE_COMPAT_ERRLIST used on errlist-compat.c
>>>> does not create _sys_errlist and _sys_siglist with expected sizes defined by
>>>> glibc ABI.
>>>>
>>>> I am trying to fix without resorting to compiler options.
>>>
>>> DEFINE_COMPAT_ERRLIST does not expand to code/data, just reordeable directives:
>>>
>>>
>>> .globl __GLIBC_2_1_sys_errlist
>>> .set __GLIBC_2_1_sys_errlist, _sys_errlist_internal
>>> .type __GLIBC_2_1_sys_errlist,@object
>>> .size __GLIBC_2_1_sys_errlist, 1000
>>> .globl __GLIBC_2_1__sys_errlist
>>> .set __GLIBC_2_1__sys_errlist, _sys_errlist_internal
>>> .type __GLIBC_2_1__sys_errlist,@object
>>> .size __GLIBC_2_1__sys_errlist, 1000
>>> .symver __GLIBC_2_1_sys_nerr, sys_nerr@GLIBC_2.2.5
>>> .symver __GLIBC_2_1__sys_nerr, _sys_nerr@GLIBC_2.2.5
>>> .symver __GLIBC_2_1_sys_errlist, sys_errlist@GLIBC_2.2.5
>>> .symver __GLIBC_2_1__sys_errlist, _sys_errlist@GLIBC_2.2.5
>>> .globl __GLIBC_2_3_sys_errlist
>>> .set __GLIBC_2_3_sys_errlist, _sys_errlist_internal
>>> .type __GLIBC_2_3_sys_errlist,@object
>>> .size __GLIBC_2_3_sys_errlist, 1008
>>> .globl __GLIBC_2_3__sys_errlist
>>> .set __GLIBC_2_3__sys_errlist, _sys_errlist_internal
>>> .type __GLIBC_2_3__sys_errlist,@object
>>> .size __GLIBC_2_3__sys_errlist, 1008
>>> .symver __GLIBC_2_3_sys_nerr, sys_nerr@GLIBC_2.3
>>> .symver __GLIBC_2_3__sys_nerr, _sys_nerr@GLIBC_2.3
>>> .symver __GLIBC_2_3_sys_errlist, sys_errlist@GLIBC_2.3
>>> .symver __GLIBC_2_3__sys_errlist, _sys_errlist@GLIBC_2.3
>>> .globl __GLIBC_2_4_sys_errlist
>>>
>>> I do not know whether GCC would reorder these macros. Even yes,
>>> that'd just change the .symtab entries in the relocatable object file.
>>> The linker behavior remains the same with reordering.
>>
>> It does not seem to, just remove the -fno-unit-at-a-time and issue make
>> check-abi and you will see that object size for the compat symbols
>> reference to _sys_err_internal instead of the define compat ones.
>
> I see. I think this is a brittle behavior in GNU assembler. Filed
> https://sourceware.org/bugzilla/show_bug.cgi?id=29012 with detailed
> information. I have created a patch but I know that will not solve
> glibc's problem :(
It would be good to have this fixes, but unfortunately we need a way
to handle this on older binutils. I am kind worried that the only
possible way to actually fix this without resorting to any compiler
flags is coding the array definitions in assembly direct...
More information about the Libc-alpha
mailing list