This is the mail archive of the libc-alpha@sourceware.org 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]

Re: Another GLIBC build error with GCC6


> Any chance I could get you to file a GCC bug for this bogus warning?
> 
> Jeff

Here is a cutdown test case, but I am not sure exactly what
DT_EXTRATAGIDX is trying to accomplish so I can't explain why GCC should
(or should not) give a warning here.  If you define MODIFIED you get
the code with my new definition of DT_EXTRATAGIDX and fewer warnings
but the if statement still gives a warning in either case.

Steve Ellcey



#include <stdint.h>

typedef uint32_t Elf32_Word;
typedef	int32_t  Elf32_Sword;

typedef struct
{
	int x;
} Elf32_Dyn;

#define	DT_NUM		 34
#define DT_MIPS_NUM	 0x36
#define DT_THISPROCNUM	 DT_MIPS_NUM
#define DT_VERSIONTAGNUM 16
#define DT_EXTRANUM	 3
#define DT_VALNUM        12
#define DT_ADDRNUM       11

#define DT_AUXILIARY    0x7ffffffd
#define DT_FILTER       0x7fffffff

#ifndef MODIFIED
#define DT_EXTRATAGIDX(tag)	((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)  /* original version */
#else
#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) & 0x7fffffff)-1) /* my new version */
#endif

#define DT_NEEDED	1
#define AUXTAG  (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
                 + DT_EXTRATAGIDX (DT_AUXILIARY))
#define FILTERTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
                   + DT_EXTRATAGIDX (DT_FILTER))

/*  include/elf.h */
Elf32_Dyn *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
                      + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];

int foo()
{
 if (l_info[DT_NEEDED] || l_info[AUXTAG] || l_info[FILTERTAG])
   return 1;
 else
   return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]