| Message ID | 25b56bae752eb6b1c50c2f8df420eadb3f12faa1.camel@kernkonzept.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series | [uclibc-ng-devel] Use __ehdr_start as known zero link address symbol | expand |
Hi Marcus, applied, tested and pushed. best regards Waldemar Marcus Hähnel wrote, > Hello devs, > > The _start symbol does not necessarily have to be on the first page of the application. But the __ehdr_start symbol is > always at address zero for PIE binaries. > > So now we know how it works ;) > > Best regards, > > - Marcus > > > -- > +++++++++++++++++++ > > > Register now for our workshop "Get to know L4Re in 3 days" on April 8-10. Learn to design and deploy secure system > architectures for your product with L4Re: https://www.kernkonzept.com/workshop-getting-started-with-l4re/ > > +++++++++++++++++++ > > Kernkonzept GmbH > Sitz: Dresden > HRB 31129 > Geschäftsführer: Dr.-Ing. Michael Hohmuth > > > From 6bff37e29b34740e2ff0d2b6b8ab57e54c0580ed Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= <jan.kloetzke@kernkonzept.com> > Date: Wed, 19 Mar 2025 08:04:44 +0100 > Subject: [PATCH] Use __ehdr_start as known zero link address symbol > > The _start symbol does not necessarily have to be on the first page of > the application. But the __ehdr_start symbol is always at address zero > for PIE binaries. > > Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com> > --- > libc/sysdeps/linux/aarch64/crt1.S | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libc/sysdeps/linux/aarch64/crt1.S b/libc/sysdeps/linux/aarch64/crt1.S > index e9f946894..965d3265d 100644 > --- a/libc/sysdeps/linux/aarch64/crt1.S > +++ b/libc/sysdeps/linux/aarch64/crt1.S > @@ -52,8 +52,8 @@ _start: > /* Save off the atexit pointer */ > mov x19, x0 > > - /* Calculate load address... idk how this works, but it does */ > - adrp x0, _start > + /* "Calculate" load address. The link address of __ehdr_start is 0. */ > + adrp x0, __ehdr_start > > /* Do relocations */ > bl reloc_static_pie > -- > 2.47.1 > > _______________________________________________ > devel mailing list -- devel@uclibc-ng.org > To unsubscribe send an email to devel-leave@uclibc-ng.org
From 6bff37e29b34740e2ff0d2b6b8ab57e54c0580ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= <jan.kloetzke@kernkonzept.com> Date: Wed, 19 Mar 2025 08:04:44 +0100 Subject: [PATCH] Use __ehdr_start as known zero link address symbol The _start symbol does not necessarily have to be on the first page of the application. But the __ehdr_start symbol is always at address zero for PIE binaries. Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com> --- libc/sysdeps/linux/aarch64/crt1.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/aarch64/crt1.S b/libc/sysdeps/linux/aarch64/crt1.S index e9f946894..965d3265d 100644 --- a/libc/sysdeps/linux/aarch64/crt1.S +++ b/libc/sysdeps/linux/aarch64/crt1.S @@ -52,8 +52,8 @@ _start: /* Save off the atexit pointer */ mov x19, x0 - /* Calculate load address... idk how this works, but it does */ - adrp x0, _start + /* "Calculate" load address. The link address of __ehdr_start is 0. */ + adrp x0, __ehdr_start /* Do relocations */ bl reloc_static_pie -- 2.47.1