Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build,android: Added option to compile for Android with -fPIE flag #5783

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion android-configure
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ export LINK=$TOOLCHAIN/bin/arm-linux-androideabi-g++

./configure \
--dest-cpu=arm \
--dest-os=android
--dest-os=android \
--cflag-pie=true \
--without-snapshot
8 changes: 8 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
}],
['cflag_pie=="true"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down Expand Up @@ -101,6 +105,10 @@
['OS!="mac" and OS!="win"', {
'cflags': [ '-fno-omit-frame-pointer' ],
}],
['cflag_pie=="true"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down
10 changes: 10 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ parser.add_option('--enable-static',
dest='enable_static',
help='build as static library')

parser.add_option('--cflag-pie',
action='store',
choices=('true', 'false'),
default='false',
dest='cflag_pie',
help='add cflags -fPIE')

(options, args) = parser.parse_args()

# Expand ~ in the install prefix now, it gets written to multiple files.
Expand Down Expand Up @@ -666,6 +673,9 @@ def configure_mips(o):
def configure_node(o):
if options.dest_os == 'android':
o['variables']['OS'] = 'android'

o['variables']['cflag_pie'] = options.cflag_pie

o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
Expand Down