Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(942)

Issue 4071044: code review 4071044: 6l: Relocate CMOV* instructions (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by niemeyer
Modified:
14 years, 1 month ago
Reviewers:
CC:
golang-dev, rsc
Visibility:
Public.

Description

6l: Relocate CMOV* instructions The linker avoids a GOT indirection by turning a MOV into a LEA, but with x86-64 GCC has started emitting CMOV* instructions which break the existing logic. This will generate errors such as: unexpected GOT reloc for non-dynamic symbol luaO_nilobject_ The CMOV* instructions may be emitted with normal code like: if (o >= L->top) return cast(TValue *, luaO_nilobject); else return o; Which gets compiled into (relocation offset at 1b): 13: 48 3b 47 10 cmp 0x10(%rdi),%rax 17: 48 0f 43 05 00 00 00 cmovae 0x0(%rip),%rax 1e: 00 This change will allow the indirection through the GOT to avoid the problem in those cases.

Patch Set 1 #

Patch Set 2 : code review 4071044: 6l: Relocate CMOV* instructions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -7 lines) Patch
M src/cmd/6l/asm.c View 1 chunk +7 lines, -7 lines 0 comments Download

Messages

Total messages: 5
niemeyer
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 1 month ago (2011-01-27 17:50:52 UTC) #1
rsc
I am not sure that using the GOT is the right fix in general. That ...
14 years, 1 month ago (2011-01-27 18:04:02 UTC) #2
niemeyer
Yes, I agree that exporting the symbol is an unfortunate consequence of this fix. To ...
14 years, 1 month ago (2011-01-27 18:22:02 UTC) #3
rsc
LGTM
14 years, 1 month ago (2011-01-27 18:42:51 UTC) #4
rsc
14 years, 1 month ago (2011-01-27 19:09:10 UTC) #5
*** Submitted as 9b9685cabc05 ***

6l: Relocate CMOV* instructions

The linker avoids a GOT indirection by turning a MOV into
a LEA, but with x86-64 GCC has started emitting CMOV*
instructions which break the existing logic.

This will generate errors such as:

  unexpected GOT reloc for non-dynamic symbol luaO_nilobject_

The CMOV* instructions may be emitted with normal code like:

  if (o >= L->top) return cast(TValue *, luaO_nilobject);
  else return o;

Which gets compiled into (relocation offset at 1b):

  13: 48 3b 47 10             cmp    0x10(%rdi),%rax
  17: 48 0f 43 05 00 00 00    cmovae 0x0(%rip),%rax
  1e: 00

This change will allow the indirection through the GOT to
avoid the problem in those cases.

R=golang-dev, rsc
CC=golang-dev
http://codereview.appspot.com/4071044

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b