Skip to content

Instantly share code, notes, and snippets.

@seven332
Last active July 15, 2016 17:43
Show Gist options
  • Select an option

  • Save seven332/8003f14c8509a26cddb6282cd39769d1 to your computer and use it in GitHub Desktop.

Select an option

Save seven332/8003f14c8509a26cddb6282cd39769d1 to your computer and use it in GitHub Desktop.

arm64-v8a

CPPFLAGS

-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -O2 -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

x86_64

CPPFLAGS

-ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -O2 -DNDEBUG -DANDROID -Wformat -Wa,--noexecstack -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

mips64

CPPFLAGS

-fpic -finline-functions -ffunction-sections -funwind-tables -fstack-protector-strong -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -no-canonical-prefixes -g -O2 -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

armeabi-v7a

CPPFLAGS

-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -mthumb -Os -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

armeabi

CPPFLAGS

-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -g -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

x86

CPPFLAGS

-ffunction-sections -funwind-tables -no-canonical-prefixes -g -fstack-protector-strong -O2 -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

mips

CPPFLAGS

-fpic -finline-functions -ffunction-sections -funwind-tables -fstack-protector-strong -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -no-canonical-prefixes -g -O2 -DNDEBUG -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security

LDFLAGS

-lgcc -no-canonical-prefixes -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -lc -lm

Note

For gcc

EXE CFLAGS and CXXFLAGS needs: -fPIE

EXE LDFLAGS needs: -fPIE -pie -Wl,--gc-sections -Wl,-z,nocopyreloc

PIE only work for API 16 and above, and PIE must apply for API 21 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment