This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Matt Austern <austern@apple.com> writes: > On Dec 2, 2003, at 5:36 AM, Andreas Jaeger wrote: > >> Robert Moss <robert.moss@jesus.ox.ac.uk> writes: >> >>> Andreas, can you confirm that this is in fact the problem, and that >>> it's nothing to do with the (possibly slightly ridiculous) situation >>> in glibc in which the source uses asm behind gcc's back in relation to >>> weak functions? >>> >>> Rob >> >> Let's wait for a GCC patch - but looking at the assembly it really >> seems to be a issue with broken hidden support.\ > > As you might have noticed from following the discussion on the > gcc list, the main reason I haven't fixed this yet is that we haven't > yet reached an agreement about what the semantics of the > visibility attribute should be when you've got multiple declarations > of the same symbol. > > What assumptions does the glibc source make about this, and how > tightly wedded are you to those assumptions? Here's some analysis from my colleague Michael Matz on the issue as it hits us in glibc - in the first 20 assembler instructions that are executed ;-(. } A short testcase is: } --------------------- } extern long bla(void); } long myglobal __attribute__((visibility("hidden"))); } extern long myglobal __attribute__((alias("blubba"))); } void _dl_start (void) } { } myglobal = 1; } } } --------------------- } } The 3.3 branch correctly merges the two attribute declarations on } "myglobal". I.e. the assembler looks like so (-O1 -fPIC, amd64): } } ---- good.s ----- } .globl myglobal } .hidden myglobal } .set myglobal,blubba } ... } _dl_start: } movq $1, myglobal(%rip) } ret } ----------------- } } The HEAD branch isn't able to merge the two attributes, and hence forgets } the "hidden" declaration on myglobal, ergo generates this code: } } ------ bad.s ------ } .globl myglobal } .set myglobal,blubba } .... } _dl_start: } movq myglobal@GOTPCREL(%rip), %rax } movq $1, (%rax) } ret } ------------------- } } There are two issues. The first would also affect normal code, namely } that this symbol doesn't have "hidden" visibility in the object file } anymore, hence would be exported from the DSO. But what hits us in glibc } is, that similar code is used in ld.so at a point where it's not yet } relocated. This means that the content of the GOT isn't correct yet. But } the second version goes over the GOT to access 'myglobal'. If it were } hidden for GCC it would correctly use a direct RIP-based access like in } the first example. Hope this example helps a bit, Andreas -- Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |