This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH: Update DF_1_XXX from Solaris
On Fri, Nov 16, 2012 at 7:30 AM, Carlos O'Donell
<carlos@systemhalted.org> wrote:
> On Fri, Nov 16, 2012 at 10:26 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Fri, Nov 16, 2012 at 7:02 AM, Carlos O'Donell
>> <carlos@systemhalted.org> wrote:
>>> On Fri, Nov 16, 2012 at 9:56 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Fri, Nov 16, 2012 at 6:47 AM, Carlos O'Donell
>>>> <carlos@systemhalted.org> wrote:
>>>>> On Fri, Nov 16, 2012 at 9:39 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>>> 2012-11-16 H.J. Lu <hongjiu.lu@intel.com>
>>>>>>>>
>>>>>>>> * elf.h (DF_1_NODIRECT): New macro.
>>>>>>>> (DF_1_IGNMULDEF): Likewise.
>>>>>>>> (DF_1_NOKSYMS): Likewise.
>>>>>>>> (DF_1_NOHDR): Likewise.
>>>>>>>> (DF_1_EDITED): Likewise.
>>>>>>>> (DF_1_NORELOC): Likewise.
>>>>>>>> (DF_1_SYMINTPOSE): Likewise.
>>>>>>>> (DF_1_GLOBAUDIT): Likewise.
>>>>>>>> (DF_1_SINGLETON): Likewise.
>>>>>>>
>>>>>>> What is the purpose of this change?
>>>>>>
>>>>>> To make DF_1_XXX macros more complete.
>>>>>
>>>>> In your opinion what should happen in the loader
>>>>> if we have a flag set that we don't support?
>>>>>
>>>>
>>>> I believe we currently simply ignore them.
>>>
>>> That's not the question I was asking though.
>>> I'm asking for *your* opinion on what the loader
>>> should do in the face of flags it can't honour?
>>>
>>
>> I think we should issue an error and stop.
>
> I agree :-)
>
> Therefore can you amend your patch to issue an error and stop
> when we find any of the flags we can't handle, including the
> new ones you wish to add?
>
> I'll review your new patch.
>
Here is the new patch. However, I'd like to fix
http://www.sourceware.org/bugzilla/show_bug.cgi?id=14853
so that we can add DF_1_GLOBAL to supported bits. To test
it, I need to add a "-z global" linker option to set DF_1_GLOBAL.
--
H.J.
---
2012-11-16 H.J. Lu <hongjiu.lu@intel.com>
* elf/elf.h (DF_1_NODIRECT): New macro.
(DF_1_IGNMULDEF): Likewise.
(DF_1_NOKSYMS): Likewise.
(DF_1_NOHDR): Likewise.
(DF_1_EDITED): Likewise.
(DF_1_NORELOC): Likewise.
(DF_1_SYMINTPOSE): Likewise.
(DF_1_GLOBAUDIT): Likewise.
(DF_1_SINGLETON): Likewise.
* elf/get-dynamic-info.h (elf_get_dynamic_info): Assert
DT_1_SUPPORTED_MASK bits.
* include/elf.h (DT_1_SUPPORTED_MASK): New macro.
diff --git a/elf/elf.h b/elf/elf.h
index 1effa07..b07e6ad 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -798,6 +798,15 @@ typedef struct
#define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
#define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
#define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
+#define DF_1_NODIRECT 0x00020000 /* Object has no-direct binding. */
+#define DF_1_IGNMULDEF 0x00040000
+#define DF_1_NOKSYMS 0x00080000
+#define DF_1_NOHDR 0x00100000
+#define DF_1_EDITED 0x00200000 /* Object is modified after built. */
+#define DF_1_NORELOC 0x00400000
+#define DF_1_SYMINTPOSE 0x00800000 /* Object has individual interposers. */
+#define DF_1_GLOBAUDIT 0x01000000 /* Global auditin required. */
+#define DF_1_SINGLETON 0x02000000 /* Singleton symbols are used. */
/* Flags for the feature selection in DT_FEATURE_1. */
#define DTF_1_PARINIT 0x00000001
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index ffac75f..9e018de 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -151,6 +151,9 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
{
l->l_flags_1 = info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val;
+ /* Only DT_1_SUPPORTED_MASK bits are allowed. */
+ assert ((l->l_flags_1 & ~DT_1_SUPPORTED_MASK) == 0);
+
if (l->l_flags_1 & DF_1_NOW)
info[DT_BIND_NOW] = info[VERSYMIDX (DT_FLAGS_1)];
}
diff --git a/include/elf.h b/include/elf.h
index cdedd85..60658c6 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -3,4 +3,10 @@
/* Some information which is not meant for the public and therefore not
in <elf.h>. */
# include <dl-dtprocnum.h>
+# ifdef DT_1_SUPPORTED_MASK
+# error DT_1_SUPPORTED_MASK is defined!
+# endif
+# define DT_1_SUPPORTED_MASK \
+ (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
+ | DF_1_ORIGIN | DF_1_NODEFLIB)
#endif