libc: remove ctors/dtors sections

None of the supported ARCHs actually populate these sections,
so there is no point in keeping them in the binaries.

Change-Id: I21a364f510118ac1114e1b49c53ec8c895c6bc6b
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@gmail.com>
This commit is contained in:
Ard Biesheuvel 2012-08-21 14:47:58 +02:00
parent 404e28ff8c
commit 0a150ead18
6 changed files with 1 additions and 41 deletions

View File

@ -31,7 +31,6 @@ typedef struct
void (**preinit_array)(void);
void (**init_array)(void);
void (**fini_array)(void);
void (**ctors_array)(void);
} structors_array_t;
extern int main(int argc, char **argv, char **env);
@ -52,10 +51,7 @@ void (*__INIT_ARRAY__)(void) = (void (*)(void)) -1;
__attribute__ ((section (".fini_array")))
void (*__FINI_ARRAY__)(void) = (void (*)(void)) -1;
__attribute__ ((section (".ctors")))
void (*__CTOR_LIST__)(void) = (void (*)(void)) -1;
__attribute__((visbility("hidden")))
__attribute__((visibility("hidden")))
void _start() {
structors_array_t array;
void *elfdata;
@ -63,7 +59,6 @@ void _start() {
array.preinit_array = &__PREINIT_ARRAY__;
array.init_array = &__INIT_ARRAY__;
array.fini_array = &__FINI_ARRAY__;
array.ctors_array = &__CTOR_LIST__;
elfdata = __builtin_frame_address(0) + sizeof(void *);
__libc_init(elfdata, (void *) 0, &main, &array);

View File

@ -35,9 +35,6 @@
.section .fini_array, "aw"
.long 0
.section .ctors, "aw"
.long 0
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -70,8 +70,6 @@ _start:
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
.long __FINI_ARRAY__
.long __CTOR_LIST__
.long __DTOR_LIST__
.section .preinit_array, "aw"
.type __PREINIT_ARRAY__, @object
@ -92,18 +90,6 @@ __FINI_ARRAY__:
.long -1
.long __do_global_dtors_aux
.section .ctors, "aw"
.type __CTOR_LIST__, @object
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
.section .dtors, "aw"
.type __DTOR_LIST__, @object
.globl __DTOR_LIST__
__DTOR_LIST__:
.long -1
.abicalls
.text
.align 2

View File

@ -35,13 +35,3 @@
.section .fini_array, "aw"
.long 0
.section .ctors, "aw"
.type __CTOR_END__, @object
__CTOR_END__:
.long 0
.section .dtors, "aw"
.type __DTOR_END__, @object
__DTOR_END__:
.long 0

View File

@ -35,9 +35,6 @@ typedef struct
void (**preinit_array)(void);
void (**init_array)(void);
void (**fini_array)(void);
#ifndef __i386__
void (**ctors_array)(void);
#endif
} structors_array_t;
extern void __libc_init_common(uintptr_t *elfdata);

View File

@ -80,11 +80,6 @@ __noreturn void __libc_init(uintptr_t *elfdata,
/* pre-init array. */
call_array(structors->preinit_array);
#ifndef __i386__
/* .ctors section initializers, for non-arm-eabi ABIs */
call_array(structors->ctors_array);
#endif
// call static constructors
call_array(structors->init_array);