diff options
| author | 2018-05-17 16:03:59 -0700 | |
|---|---|---|
| committer | 2018-05-18 02:12:37 +0000 | |
| commit | 3ba2f86ae731aff8f751ccacec4996eb57e11d0d (patch) | |
| tree | e32aed54de86d1abea8cce44b5571393c7f12bbb | |
| parent | 1236c388170f352adf9c9a3347de4560995c20b1 (diff) | |
Switch x86/x64 trampolines to use __attribute__((naked))
Switching to clang++ means __attribute__((optimize)) is no longer
recognized. However, we do get __attribute__((naked)).
Slightly larger change than I'd like because __attribute__((naked))
doesn't permit C variable declarations.
Change-Id: I558ccaf292e381d33e10c5034053cdc651eff5f2
Bug: b/79574249
Test: TBC
| -rw-r--r-- | opengl/libs/EGL/getProcAddress.cpp | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp index 0183621299..fedc7893db 100644 --- a/opengl/libs/EGL/getProcAddress.cpp +++ b/opengl/libs/EGL/getProcAddress.cpp @@ -80,46 +80,44 @@ namespace android { #elif defined(__i386__) - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api + #define API_ENTRY(_api) __attribute__((naked)) _api #define CALL_GL_EXTENSION_API(_api) \ - register void** fn; \ __asm__ volatile( \ - "mov %%gs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "cmovne %P[api](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ + "mov %%gs:0, %%eax\n" \ + "mov %P[tls](%%eax), %%eax\n" \ + "test %%eax, %%eax\n" \ + "cmovne %P[api](%%eax), %%eax\n" \ + "test %%eax, %%eax\n" \ "je 1f\n" \ - "jmp *%[fn]\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ + "jmp *%%eax\n" \ + "1: ret\n" \ + : \ : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ [api] "i" (__builtin_offsetof(gl_hooks_t, \ ext.extensions[_api])) \ - : "cc" \ + : "eax", "cc" \ ); #elif defined(__x86_64__) - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api + #define API_ENTRY(_api) __attribute__((naked)) _api #define CALL_GL_EXTENSION_API(_api) \ - register void** fn; \ __asm__ volatile( \ - "mov %%fs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "cmovne %P[api](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ + "mov %%fs:0, %%rax\n" \ + "mov %P[tls](%%rax), %%rax\n" \ + "test %%rax, %%rax\n" \ + "cmovne %P[api](%%rax), %%rax\n" \ + "test %%rax, %%rax\n" \ "je 1f\n" \ - "jmp *%[fn]\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ + "jmp *%%rax\n" \ + "1: ret\n" \ + : \ : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ [api] "i" (__builtin_offsetof(gl_hooks_t, \ ext.extensions[_api])) \ - : "cc" \ + : "rax", "cc" \ ); #elif defined(__mips64) |