PING^2: [PATCH] elf: Avoid nested functions in the loader (all ports) [BZ #27220]

Fāng-ruì Sòng maskray@google.com
Wed Sep 22 18:40:37 GMT 2021


On 2021-09-22, Carlos O'Donell wrote:
>On 9/22/21 14:09, Joseph Myers wrote:
>> On Wed, 22 Sep 2021, Carlos O'Donell via Libc-alpha wrote:
>>
>>> - Split this patch up into more logical changes.
>>
>> I'm not convinced there's much scope for splitting up this patch more; it
>> is a logical change (versions that changed only some architectures were a
>> lot uglier).  My comment about logical changes was a more generic one, not
>> suggesting that this particular patch should be split up further.
>
>Thanks for the clarification. In which case the more detailed review of the boostrap
>relocations is the remaining point.

I really appreciate that Clang buildability is well-received :)
I went ahead and filed https://sourceware.org/bugzilla/show_bug.cgi?id=28376 "[meta] Build glibc with Clang"
to collect miscellaneous small fixes.

---

I agree that this patch is difficult to split.
Modifying the elf/ macro parameters requires fixing all use sites.

The latest version is at https://github.com/MaskRay/glibc/tree/unnest
(I use a different repo instead of the canonical sourceware repo in the fear of pushing bad commits to sourceware :)

About the global variables (cur_*): they are in elf/dl-reloc.c

-    /* String table object symbols.  */
-    const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
+    cur_l = l;
+    cur_scope = scope;
+    cur_strtab = (const void *) D_PTR (cur_l, l_info[DT_STRTAB]);

removing them requires more parameters to ELF_DYNAMIC_RELOCATE and RESOLVE_MAP.
Is that the direction you are imagining?

BTW: I am not familiar with the concept of bootstrap relocations.
Does it refer to relocations in ld.so itself   and   all relocations in a static pie?

---

FWIW I initially sent
https://sourceware.org/pipermail/libc-alpha/2021-August/130340.html
(https://github.com/MaskRay/glibc/tree/nesting)
which is a more literal take from
https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/google/grte/v5-2.27/master

But I slightly dislike the version myself because it duplicates lots of macros.
(This branch can give some insight for needed Clang fixes but many commits need rewrite for master.)


More information about the Libc-alpha mailing list