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: run android builder with android-L devices. #10807

Closed
hyangah opened this issue May 13, 2015 · 10 comments
Closed

build: run android builder with android-L devices. #10807

hyangah opened this issue May 13, 2015 · 10 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented May 13, 2015

The current builder cross-compiles the test binaries, runs the compiled binaries on the device, and parses the output of them. This does not work for android-L that requires PIE and refuses to run the test binaries with the following error message.

"only position independent executables (PIE) are supported."

Probably related to : #6940

@minux
Copy link
Member

minux commented May 17, 2015

Does Android L support PIE executable with text relocations?

We can easily generate PIE executable if text relocation is supported.
External linking with PIE (#6940) is a different story though.
(Removing text relocations is ##9210).

To eliminate text relocations, we need to modify the way we load
addresses into registers. Right now, we use constant pool entry
for absolute address, to support PIE (or PIC), we have to use PC
relative load.

MOVW addr(SB), R0 is currently translated to:
ldr r11, [pc, #cpoff]; constant pool uses R_ADDR reloc.
ldr r0, [r11]

To switch to PIC, it needs to be translated to:
ldr r11, [pc, #cpoff]; constant pool uses R_PCREL+addend
ldr r0, [pc, r11]

MOVW $addr(SB), R1 is currently translated to:
ldr r1, [pc, #cpoff]
To switch to PIC, it needs to be:
ldr r11, [pc, #cpoff]
add r11, pc, r1

@ianlancetaylor ianlancetaylor added this to the Unreleased milestone Jun 3, 2015
@quarnster
Copy link

Just adding -ldflags="-extldflags=-pie" works on my Nexus 6. While it complains about the text relocations, it appears to work just fine:
W/linker (12596): /data/local/tmp/test has text relocations. This is wasting memory and prevents security hardening. Please fix.

@crawshaw
Copy link
Member

@quarnster huh, that didn't work last time I tried it, but you're right.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16055 mentions this issue.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16054 mentions this issue.

crawshaw added a commit that referenced this issue Oct 19, 2015
For #10807

Change-Id: Ied826d06cb622edf6413b6f2cdcc46987ab0b05a
Reviewed-on: https://go-review.googlesource.com/16054
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
crawshaw added a commit that referenced this issue Oct 19, 2015
Also make PIE executables the default build mode, as PIE executables
are required as of Android L.

For #10807

Change-Id: I86b7556b9792105cd2531df1b8f3c8f7a8c5d25c
Reviewed-on: https://go-review.googlesource.com/16055
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16114 mentions this issue.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16115 mentions this issue.

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16116 mentions this issue.

hyangah added a commit that referenced this issue Oct 20, 2015
Creating symlinks (/data/local/tmp/*) doesn't seem to work
on android-L (tested on nexus5). I cannot find any official
documentation yet but just guess it's a measure for security
attacks using symlinks.

The tests failed with 'permission denied' errors.

For #10807

Change-Id: I99a9c401c6ecca3c4adc7b21708adaf3dd601279
Reviewed-on: https://go-review.googlesource.com/16115
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
hyangah added a commit that referenced this issue Oct 20, 2015
Same reason as https://go-review.googlesource.com/#/c/16115/

For #10807

Change-Id: Id0c404e9feb963f39a111fc317c9787692516ae1
Reviewed-on: https://go-review.googlesource.com/16116
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
hyangah added a commit that referenced this issue Oct 21, 2015
unix/unixgram is not available to standard Android programs.

For #10807

Change-Id: I6062c3a25cffb86e58cbbd12a07dc90ffbf57185
Reviewed-on: https://go-review.googlesource.com/16114
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16396 mentions this issue.

hyangah added a commit that referenced this issue Oct 28, 2015
For #10743 #10807

Change-Id: I35dedb52e2b47fe7ffc655d01f22ac05fe830bde
Reviewed-on: https://go-review.googlesource.com/16396
Reviewed-by: David Crawshaw <crawshaw@golang.org>
fsouza pushed a commit to fsouza/go that referenced this issue Feb 25, 2016
For golang/go#10743 golang/go#10807

Change-Id: I35dedb52e2b47fe7ffc655d01f22ac05fe830bde
Reviewed-on: https://go-review.googlesource.com/16396
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@eliasnaur eliasnaur added the mobile Android, iOS, and x/mobile label Mar 5, 2018
@eliasnaur
Copy link
Contributor

I believe this can be closed. android/arm and android/arm64 run on Android M devices and android/386 and android/amd64 on Android O emulators.

@golang golang locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

7 participants