This is an archive of the discontinued LLVM Phabricator instance.

Prefer -Ttext over linker script values
ClosedPublic

Authored by rafael on Jun 16 2017, 6:23 PM.

Details

Reviewers
ruiu
Summary

I found this while trying to build u-boot. It uses -Ttext in combination with linker scripts.

My first reaction was to change the linker scripts to have the correct value, but I found that it is actually quite convenient to have -Ttext take precedence.

By having just

.text : { *(.text) }

In the script, they can define the text address in a single Makefile and pass it to ld with -Ttext and for the C code with -DFoo=value. Doing the same with linker scripts would require them to be generated during the build.

Diff Detail

Event Timeline

rafael created this revision.Jun 16 2017, 6:23 PM

I like this idea.

ruiu accepted this revision.Jun 17 2017, 4:21 PM

LGTM

This revision is now accepted and ready to land.Jun 17 2017, 4:21 PM