This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Report an error if empty sections are referenced in LOADADDR/ADDR commands.
AbandonedPublic

Authored by grimar on Nov 30 2018, 4:08 AM.

Details

Summary

If script references empty sections in LOADADDR/ADDR commands:

.empty  : { *(.empty ) }
.text   : AT(LOADADDR (.empty) + SIZEOF (.empty)) { *(.text) }

then an empty section will be removed and LOADADDR/ADDR will evaluate to null.
It is not that user may expect from using of the generic script, what is a common case.

This is an alternative version of D54621, in this patch, I just report an error in this case,
so that we do not emit broken output silently.

Diff Detail

Event Timeline

grimar created this revision.Nov 30 2018, 4:08 AM

I personally would prefer D54621 but I think this is better than producing incorrect output.

test/ELF/linkerscript/empty-sections-expressions.test
5

The FileCheck part of the command looks to have been corrupted somehow. I'm seeing ileCheck %s ff.

grimar updated this revision to Diff 176099.Nov 30 2018, 5:30 AM
grimar marked an inline comment as done.
  • Fixed test case.
test/ELF/linkerscript/empty-sections-expressions.test
5

Oh. And the test still passed. Fixed, thanks!

I personally would prefer D54621 but I think this is better than producing incorrect output.

I probably also see no solid reason not to go with D54621 instead.

grimar abandoned this revision.Dec 11 2019, 12:24 AM

D54621 was landed instead.