Merge "Replace .S version of x86 crtfiles with .c version"
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
linker_begin_extension := c
|
||||
else
|
||||
linker_begin_extension := S
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
arch/$(TARGET_ARCH)/begin.S \
|
||||
arch/$(TARGET_ARCH)/begin.$(linker_begin_extension) \
|
||||
debugger.cpp \
|
||||
dlfcn.cpp \
|
||||
linker.cpp \
|
||||
|
||||
40
linker/arch/x86/begin.S → linker/arch/x86/begin.c
Normal file → Executable file
40
linker/arch/x86/begin.S → linker/arch/x86/begin.c
Normal file → Executable file
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -26,22 +26,30 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.text
|
||||
.align 4
|
||||
.type _start, @function
|
||||
.globl _start
|
||||
extern unsigned __linker_init(unsigned int *elfdata);
|
||||
|
||||
_start:
|
||||
/* save the elfdata ptr to %eax, AND push it onto the stack */
|
||||
mov %esp, %eax
|
||||
pushl %esp
|
||||
__attribute__((visibility("hidden")))
|
||||
void _start() {
|
||||
void *elfdata;
|
||||
void (*start)(void);
|
||||
|
||||
pushl %eax
|
||||
call __linker_init
|
||||
elfdata = __builtin_frame_address(0) + sizeof(void *);
|
||||
start = (void(*)(void))__linker_init(elfdata);
|
||||
|
||||
/* linker init returns (%eax) the _entry address in the main image */
|
||||
/* entry point expects sp to point to elfdata */
|
||||
popl %esp
|
||||
jmp *%eax
|
||||
/* linker init returns (%eax) the _entry address in the main image */
|
||||
/* entry point expects sp to point to elfdata */
|
||||
|
||||
#include "arch-x86/bionic/__stack_chk_fail_local.S"
|
||||
__asm__ (
|
||||
"mov %0, %%esp\n\t"
|
||||
"jmp *%1\n\t"
|
||||
: : "r"(elfdata), "r"(start) :
|
||||
);
|
||||
|
||||
/* Unreachable */
|
||||
}
|
||||
|
||||
/* Since linker has its own version of crtbegin (this file) it should have */
|
||||
/* own version of __stack_chk_fail_local for the case when it's built with */
|
||||
/* stack protector feature */
|
||||
|
||||
#include "arch-x86/bionic/__stack_chk_fail_local.h"
|
||||
Reference in New Issue
Block a user