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

bbl: change-address not recognized by llvm-objcopy #267

Open
ZenithalHourlyRate opened this issue Feb 6, 2022 · 2 comments
Open

bbl: change-address not recognized by llvm-objcopy #267

ZenithalHourlyRate opened this issue Feb 6, 2022 · 2 comments

Comments

@ZenithalHourlyRate
Copy link
Contributor

In bbl/bbl.mk.in, bbl.bin is built using change-addresses.

$(OBJCOPY) -S -O binary --change-addresses -@MEM_START@ $< $@

However, this is not recognized by llvm-objcopy.

llvm-objcopy: error: unknown argument '--change-addresses'

Instead, GNU binutils objcopy and llvm-objcopy both have an option called --change-start, but I do not know whether this option works as I have not tried bbl under my workflow (my workflow only needs pk thus I have to invoke make pk instead of justmake)

@aswaterman
Copy link
Collaborator

I don't have any way of testing this, either. Until someone can verify a fix for both, assume that you must use GNU objcopy for this.

@MaskRay
Copy link
Contributor

MaskRay commented Feb 9, 2022

As an llvm-objcopy contributor: llvm-objcopy does not support --change-addresses/--change-section-address (llvm/llvm-project#44562 (comment)). Just changing sh_addr is not difficult to implement, but the option seems to imply some layout changes which are poorly specified. The poor specification and our unawareness of how users (riscv-pk is one, but others may use this differently) use this option makes it somewhat infeasible to implement in llvm-objcopy. I implemented --only-keep-debug by (nearly) fully understanding its behavior. For --change-addresses/--change-section-address, I'd expect something similar.

If your demand can be achieved with a linker script, you may consider a linker script command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants