@@ -127,12 +127,12 @@ using LIBC_NAMESPACE::app;
127127
128128// TODO: Would be nice to use the aux entry structure from elf.h when available.
129129struct AuxEntry {
130- uint64_t type;
131- uint64_t value;
130+ uint32_t type;
131+ uint32_t value;
132132};
133133
134134extern " C" void _start () {
135- #if 0
135+ #if 1
136136 // This TU is compiled with -fno-omit-frame-pointer. Hence, the previous value
137137 // of the base pointer is pushed on to the stack. So, we step over it (the
138138 // "+ 1" below) to get to the args.
@@ -150,7 +150,7 @@ extern "C" void _start() {
150150 // compilers can generate code assuming the alignment as required by the ABI.
151151 // If the stack pointers as setup by the OS are already aligned, then the
152152 // following code is a NOP.
153- __asm__ __volatile__("nop \n\t");
153+ LIBC_INLINE_ASM ( " r29 = and(r29, #0xfffffff8) \n\t " ::: );
154154
155155 auto tid = LIBC_NAMESPACE::syscall_impl<long >(SYS_gettid);
156156 if (tid <= 0 )
@@ -171,13 +171,13 @@ extern "C" void _start() {
171171
172172 // After the env array, is the aux-vector. The end of the aux-vector is
173173 // denoted by an AT_NULL entry.
174- Elf64_Phdr *programHdrTable = nullptr;
174+ Elf32_Phdr *programHdrTable = nullptr ;
175175 uintptr_t programHdrCount;
176176 for (AuxEntry *aux_entry = reinterpret_cast <AuxEntry *>(env_end_marker + 1 );
177177 aux_entry->type != AT_NULL; ++aux_entry) {
178178 switch (aux_entry->type ) {
179179 case AT_PHDR:
180- programHdrTable = reinterpret_cast<Elf64_Phdr *>(aux_entry->value);
180+ programHdrTable = reinterpret_cast <Elf32_Phdr *>(aux_entry->value );
181181 break ;
182182 case AT_PHNUM:
183183 programHdrCount = aux_entry->value ;
@@ -192,7 +192,7 @@ extern "C" void _start() {
192192
193193 app.tls .size = 0 ;
194194 for (uintptr_t i = 0 ; i < programHdrCount; ++i) {
195- Elf64_Phdr *phdr = programHdrTable + i;
195+ Elf32_Phdr *phdr = programHdrTable + i;
196196 if (phdr->p_type != PT_TLS)
197197 continue ;
198198 // TODO: p_vaddr value has to be adjusted for static-pie executables.
0 commit comments