This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Linkerscript: implemented output section [address] attribute.
ClosedPublic

Authored by grimar on Jul 22 2016, 10:24 AM.

Details

Diff Detail

Event Timeline

grimar updated this revision to Diff 65100.Jul 22 2016, 10:24 AM
grimar retitled this revision from to [ELF] - Linkerscript: implemented output section [address] attribute..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777, emaste.
davide added a subscriber: davide.Jul 22 2016, 11:49 AM

Do you have examples of linker scripts using this feature? I wasn't able to find any.

@davide we have them in FreeBSD's kernel linker script (for debug data) but they're all addr 0, e.g.:

/* DWARF debug sections.
   Symbols in the DWARF debugging sections are relative to the beginning
   of the section so we begin them at 0.  */
/* DWARF 1 */
.debug          0 : { *(.debug) }
.line           0 : { *(.line) }

@davide we have them in FreeBSD's kernel linker script (for debug data) but they're all addr 0, e.g.:

/* DWARF debug sections.
   Symbols in the DWARF debugging sections are relative to the beginning
   of the section so we begin them at 0.  */
/* DWARF 1 */
.debug          0 : { *(.debug) }
.line           0 : { *(.line) }

OK, fine.

Do you have examples of linker scripts using this feature? I wasn't able to find any.

.lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
...
}

https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=284870&view=markup#l176

I mean that "ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1))" is [address] here.

ruiu accepted this revision.Jul 23 2016, 4:00 AM
ruiu edited edge metadata.

LGTM

ELF/LinkerScript.cpp
830

Please add a comment.

// Read an address expression.
// https://sourceware.org/binutils/docs/ld/Output-Section-Address.html#Output-Section-Address
This revision is now accepted and ready to land.Jul 23 2016, 4:00 AM
grimar updated this object.Jul 25 2016, 1:37 AM
grimar edited edge metadata.
This revision was automatically updated to reflect the committed changes.
grimar updated this object.Jul 25 2016, 1:37 AM