mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 04:43:17 +08:00
Add support for creating uuid based build-id's in a MinGW32 environment.
ld * ldbuildid.c: Changes for MinGW32: Include windows.h and rpcdce.h. (validate_build_id_style): Allow "uuid" style. (generate_build_id): Fill in id_bits using UuidCreate().
This commit is contained in:

committed by
Nick Clifton

parent
8769bc4bab
commit
d0d4152fa5
@ -1,3 +1,10 @@
|
|||||||
|
2016-07-26 Igor Kudrin <ikudrin@accesssoftek.com>
|
||||||
|
|
||||||
|
* ldbuildid.c: Changes for MinGW32:
|
||||||
|
Include windows.h and rpcdce.h.
|
||||||
|
(validate_build_id_style): Allow "uuid" style.
|
||||||
|
(generate_build_id): Fill in id_bits using UuidCreate().
|
||||||
|
|
||||||
2016-07-25 Alan Modra <amodra@gmail.com>
|
2016-07-25 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* testsuite/ld-elf/sec64k.exp: Run test for arc, msp430, or1k
|
* testsuite/ld-elf/sec64k.exp: Run test for arc, msp430, or1k
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
#include "ldbuildid.h"
|
#include "ldbuildid.h"
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <windows.h>
|
||||||
|
#include <rpcdce.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define streq(a,b) strcmp ((a), (b)) == 0
|
#define streq(a,b) strcmp ((a), (b)) == 0
|
||||||
#define strneq(a,b,n) strncmp ((a), (b), (n)) == 0
|
#define strneq(a,b,n) strncmp ((a), (b), (n)) == 0
|
||||||
@ -32,10 +36,7 @@ bfd_boolean
|
|||||||
validate_build_id_style (const char *style)
|
validate_build_id_style (const char *style)
|
||||||
{
|
{
|
||||||
if ((streq (style, "md5")) || (streq (style, "sha1"))
|
if ((streq (style, "md5")) || (streq (style, "sha1"))
|
||||||
#ifndef __MINGW32__
|
|| (streq (style, "uuid")) || (strneq (style, "0x", 2)))
|
||||||
|| (streq (style, "uuid"))
|
|
||||||
#endif
|
|
||||||
|| (strneq (style, "0x", 2)))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -118,9 +119,9 @@ generate_build_id (bfd *abfd,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
sha1_finish_ctx (&ctx, id_bits);
|
sha1_finish_ctx (&ctx, id_bits);
|
||||||
}
|
}
|
||||||
#ifndef __MINGW32__
|
|
||||||
else if (streq (style, "uuid"))
|
else if (streq (style, "uuid"))
|
||||||
{
|
{
|
||||||
|
#ifndef __MINGW32__
|
||||||
int n;
|
int n;
|
||||||
int fd = open ("/dev/urandom", O_RDONLY);
|
int fd = open ("/dev/urandom", O_RDONLY);
|
||||||
|
|
||||||
@ -130,8 +131,30 @@ generate_build_id (bfd *abfd,
|
|||||||
close (fd);
|
close (fd);
|
||||||
if (n < size)
|
if (n < size)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
#else /* __MINGW32__ */
|
||||||
|
typedef RPC_STATUS (RPC_ENTRY * UuidCreateFn) (UUID *);
|
||||||
|
UUID uuid;
|
||||||
|
UuidCreateFn uuid_create = 0;
|
||||||
|
HMODULE rpc_library = LoadLibrary ("rpcrt4.dll");
|
||||||
|
|
||||||
|
if (!rpc_library)
|
||||||
|
return FALSE;
|
||||||
|
uuid_create = (UuidCreateFn) GetProcAddress (rpc_library, "UuidCreate");
|
||||||
|
if (!uuid_create)
|
||||||
|
{
|
||||||
|
FreeLibrary (rpc_library);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uuid_create (&uuid) != RPC_S_OK)
|
||||||
|
{
|
||||||
|
FreeLibrary (rpc_library);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
FreeLibrary (rpc_library);
|
||||||
|
memcpy (id_bits, &uuid, size < sizeof (UUID) ? size : sizeof (UUID));
|
||||||
|
#endif /* __MINGW32__ */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else if (strneq (style, "0x", 2))
|
else if (strneq (style, "0x", 2))
|
||||||
{
|
{
|
||||||
/* ID is in string form (hex). Convert to bits. */
|
/* ID is in string form (hex). Convert to bits. */
|
||||||
@ -149,7 +172,8 @@ generate_build_id (bfd *abfd,
|
|||||||
++id;
|
++id;
|
||||||
else
|
else
|
||||||
abort (); /* Should have been validated earlier. */
|
abort (); /* Should have been validated earlier. */
|
||||||
} while (*id != '\0');
|
}
|
||||||
|
while (*id != '\0');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
abort (); /* Should have been validated earlier. */
|
abort (); /* Should have been validated earlier. */
|
||||||
|
Reference in New Issue
Block a user