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.
llvm-svn: 305766
12 lines
357 B
ArmAsm
12 lines
357 B
ArmAsm
# REQUIRES: x86
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
# RUN: echo "SECTIONS { .text 0x200000 : { *(.text) } }" > %t.script
|
|
# RUN: ld.lld -T %t.script -Ttext 0x100000 %t.o -o %t
|
|
# RUN: llvm-readobj --elf-output-style=GNU -s %t | FileCheck %s
|
|
|
|
# CHECK: .text PROGBITS 0000000000100000
|
|
|
|
.global _start
|
|
_start:
|
|
nop
|