Date: Fri, 19 Apr 2024 18:02:53 -0400 From: "Kevin P. Neal" <kpn@neutralgood.org> To: Andrei Lascu <alas.20073@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Questions about a symbol in `libc.so` Message-ID: <ZiLqDYDx9O8O4sfW@neutralgood.org> In-Reply-To: <755e1ea7-6102-450a-bf64-bc717129e4ba@gmail.com> References: <b84b34f8-0415-40b7-9177-32fa27f06890@gmail.com> <755e1ea7-6102-450a-bf64-bc717129e4ba@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 11, 2024 at 02:42:47PM +0100, Andrei Lascu wrote: > Hello again. Just to update my previous question, I did manage to eventually > figure out where the relocation was hidden. I was aware of a number of > relocation that seemed odd, and I put them on the side, thinking I might > either have to figure them later, or they might just be some artifact. Well, > the relocation I needed was hidden among them: > > Relocation section '.rela.dyn' at offset 0x2abf8 contains 2605 entries: > Offset Info Type Sym. Value Sym. Name + > Addend > 0000001d6888 000000000403 R_AARCH64_RELATIV 13416c > 0000001d6890 000000000403 R_AARCH64_RELATIV 8b268 > 0000001d6898 000000000403 R_AARCH64_RELATIV 178108 > 0000001d68a0 000000000403 R_AARCH64_RELATIV 8b240 > 0000001d68a8 000000000403 R_AARCH64_RELATIV 15ac9c > 0000001d68b0 000000000403 R_AARCH64_RELATIV 49b29 > 0000001d68c0 000000000403 R_AARCH64_RELATIV 45bfe > > The reason I thought them odd was because they had no symbol attached to > them, just raw addressed. However, one of these offsets actually did match > what the system loader was relocating against my mystery `__sdidinit`. So > the solution was rather simple, ensure I relocate the addend into the > offset, as there is no symbol value here, and I am on my way. There are > still some odd issues here, like why are these relocations not referencing a > symbol, when seemingly they should, and why it seems these resolve via > `R_AARCH64_GLOB_DAT` at runtime, rather than via `R_AARCH64_RELATIVE` in > `/libexec/rtld-elf/aarch64/reloc.c`, but I think as long as I am making > progress, I'll let these questions get answered another time. I suggest the freebsd-hackers mailing list instead of freebsd-questions. This questions list has a lot of knowledgable people but my impression is this bunch tends to be higher in the software stack. You'll find more people on the -hackers list who can discuss, e.g, the loader and ELF and the like. -- Kevin P. Neal http://www.pobox.com/~kpn/ "14. Re-reading No. 13, I realize that it's quite possible I'm losing my mind. I'm glad that for the most part I'm not aware it's happening." -- from "20 things I'm thankful for": Fortune, Nov 29, 2004, page 230
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZiLqDYDx9O8O4sfW>