This is an archive of the discontinued LLVM Phabricator instance.

ELF2: Make .gnu.hash default instead of .hash.
AbandonedPublic

Authored by ruiu on Oct 27 2015, 1:08 PM.

Details

Reviewers
grimar

Diff Detail

Event Timeline

ruiu updated this revision to Diff 38585.Oct 27 2015, 1:08 PM
ruiu retitled this revision from to ELF2: Make .gnu.hash default instead of .hash..
ruiu updated this object.
ruiu added a reviewer: grimar.
ruiu added a subscriber: llvm-commits.
grimar added inline comments.Oct 27 2015, 1:52 PM
ELF/Config.h
63

May be it worth to rename these 2 to be placed together like HashGnu and HashSysv ? Or just make a single enum ?

ELF/Driver.cpp
176

May be it worth to explicit set flags for "both" ?

if (S == "both") {

Config->SysvHash = true;
Config->GnuHash = true;

}

it makes it more clear (I saw this first time and was need to look into Configuration to check that both works as expected + without that it depends on default initialization which can change).

test/elf2/discard-none.s
49

Do we really need to mantain adresses in such cases ? They changes often, may be we should just skip checking here like:
// CHECK-NEXT: Value: 0x
?

test/elf2/shared.s
284

Was the next part of test removed intentionaly ?

CHECK: HashTable {
CHECK-NEXT: Num Buckets: 4
CHECK-NEXT: Num Chains: 4
CHECK-NEXT: Buckets: [3, 0, 2, 0]
CHECK-NEXT: Chains: [0, 0, 0, 1]
CHECK-NEXT: }

ruiu added inline comments.Oct 27 2015, 2:01 PM
ELF/Config.h
63

GnuHash and SysvHash sound natural to me, so I'll leave them alone.

ELF/Driver.cpp
176

That is probably excessive. There are actually five cases: gnu, sysv, both, invalid argument, or no --hash-style flag. We cover four cases here. No matter how we write code for "both", the last one is pretty much implicit.

test/elf2/discard-none.s
49

I feel like this serves the purpose as a safeguard. Not sure how effective that is, but I don't think removing that is the right thing to do in this patch.

test/elf2/shared.s
284

This is intentional.

grimar accepted this revision.Oct 27 2015, 2:21 PM
grimar edited edge metadata.

LGTM except that I would do enum or bitfield instead of 2 independent variables and i still dont like initialization, but anyways its for you to decide how will be better, so..

test/elf2/discard-none.s
49

The problem I see here that single patch changes too many files that are not relative to core idea of patch at all. Also dont see whats the safeguard can be here. Does it save from addresses not being generated ?
But you`re right that it is not the problem of this patch generally.

This revision is now accepted and ready to land.Oct 27 2015, 2:21 PM
grimar added inline comments.Oct 27 2015, 2:22 PM
test/elf2/discard-none.s
49

I mean not this patch changes, but patches usually do.

The default settings for hash section should be target-specific. At least MIPS targets don't support GNU-style hash sections at all.

test/elf2/shared.s
284

It looks like we now have no tests which check HashTable section. I'd suggest to add -hash-style=sysv command line switch at least for this test case.

grimar added inline comments.Oct 28 2015, 1:39 AM
test/elf2/shared.s
284

May be would be better to add another test in another patch for testing hashtable sections then ?

grimar requested changes to this revision.Nov 13 2015, 8:47 AM
grimar edited edge metadata.

Looks like revision should be abadoned..

This revision now requires changes to proceed.Nov 13 2015, 8:47 AM
ruiu abandoned this revision.Nov 13 2015, 9:04 AM