This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] -omagic implementation
AbandonedPublic

Authored by grimar on Nov 6 2015, 8:55 AM.

Details

Reviewers
ruiu
rafael
Summary

-N, --omagic
Set the text and data sections to be readable and writable. Also, do not page-align the data segment, and disable linking against shared libraries.

Notes: bfd looks just to create single PT_LOAD and tries to keep minimal possible set of flags for it (just concatinates all sections flags that take part in PT_LOAD). Also bfd does not output empty sections, but we do. So this ones are also affect on minimal set of flags for new lld.

Diff Detail

Event Timeline

grimar updated this revision to Diff 39544.Nov 6 2015, 8:55 AM
grimar retitled this revision from to [ELF2] -omagic implementation.
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

От: davide.italiano@gmail.com [davide.italiano@gmail.com] от имени Davide Italiano [davide@freebsd.org]
Отправлено: 6 ноября 2015 г. 20:10
Кому: George Rimar; reviews+D14449+public+d5b6896f0026b788@reviews.llvm.org
Копия: Rafael Ávila de Espíndola; Rui Ueyama; llvm-commits@lists.llvm.org
Тема: Re: [PATCH] D14449: [ELF2] -omagic implementation

Is somebody really using this?

Well, it could be used is for -r patch (relocatable output) which status is still unclear. Its description mentions that "As a side effect, in environments that support standard Unix magic numbers, this option also sets the output file’s magic number to "OMAGIC"".
Second possible use (I guessing here) is for writing self modifiying apps.

От: George Rimar
Отправлено: 6 ноября 2015 г. 22:21
Кому: Davide Italiano; reviews+D14449+public+d5b6896f0026b788@reviews.llvm.org
Копия: Rafael Ávila de Espíndola; Rui Ueyama; llvm-commits@lists.llvm.org
Тема: HA: [PATCH] D14449: [ELF2] -omagic implementation

От: davide.italiano@gmail.com [davide.italiano@gmail.com] от имени Davide Italiano [davide@freebsd.org]
Отправлено: 6 ноября 2015 г. 20:10
Кому: George Rimar; reviews+D14449+public+d5b6896f0026b788@reviews.llvm.org
Копия: Rafael Ávila de Espíndola; Rui Ueyama; llvm-commits@lists.llvm.org
Тема: Re: [PATCH] D14449: [ELF2] -omagic implementation

Is somebody really using this?

Well, it could be used is for -r patch (relocatable output) which status is still unclear. Its description mentions that "As a side effect, in environments that support standard Unix magic numbers, this option also sets the output file’s magic number to "OMAGIC"".

Actually I am not sure that "set magic number to OMAGIC" is equals to applying -omagic here. That needs checking.
But I saw that flag usings during search about it in web, so I think it can be useful for some people.

Second possible use (I guessing here) is for writing self modifiying apps.

ruiu edited edge metadata.Nov 9 2015, 4:03 PM

I'm reluctant to add this option unless it's proved to be in use by many real-world use cases. This option seems to be for a compatibility for ancient Unix systems.

-N, --omagic
Set the text and data sections to be readable and writable. Also, do
not page-align the data segment, and disable linking against shared libraries.

I can't find any user of this in pkgsrc at least, so it really looks
like historic baggage. Most of the use cases I can think of are better
handled e.g. using objcopy.

Joerg

Ok, thank you for info.

grimar abandoned this revision.Nov 12 2015, 11:34 PM