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

Darwin X86_64_RELOC_UNSIGNED loses addend for symbol alias #19577

Open
llvmbot opened this issue Mar 20, 2014 · 5 comments
Open

Darwin X86_64_RELOC_UNSIGNED loses addend for symbol alias #19577

llvmbot opened this issue Mar 20, 2014 · 5 comments
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 20, 2014

Bugzilla Link 19203
Version trunk
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @atamazov,@bcardosolopes,@MaskRay,@lhames

Extended Description

$ cat test1.s
.data
a = b + 4
.long a
Sandman:llvm respindola$ cat test2.s
.data
a = b + 8
.long a
$ llvm-mc -filetype=obj test1.s -o test1.o -triple=x86_64-apple-darwin
$ llvm-mc -filetype=obj test2.s -o test2.o -triple=x86_64-apple-darwin
$ cmp test1.o test2.o

We should probably include the 4 and 8 in the relocation or produce an error if that is not possible.

@lhames
Copy link
Contributor

lhames commented Mar 4, 2016

The relocations are both for 'a', rather than 'b'. Looks like MC isn't checking the aliases before spitting out the relocations. I'll look into it.

@lhames
Copy link
Contributor

lhames commented Mar 7, 2016

Well... this is pretty awful.

.data
a = 4
.long a

Generates a data section containing one long initialized to four, as you'd expect. As Rafael noted, adding a symbol to the RHS like this:

.data
a = b + 4
.long a

Generates a data section with an external relocation for 'a' (not 'b').

This "feature" goes back at least to the cctools implementation of as.

My gut reaction is that we should either add a warning, or fix this behavior, or add a warning, wait a while for people to fix their horrible code, then fix this behavior.

@lhames
Copy link
Contributor

lhames commented Mar 7, 2016

Not to be fixed for now, since this matches historical behavior. I'm going to leave this open though, since we may want to revisit this in the future.

@lhames
Copy link
Contributor

lhames commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#25381

1 similar comment
@lhames
Copy link
Contributor

lhames commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#25381

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code
Projects
None yet
Development

No branches or pull requests

2 participants