Bug 172209 - devel/avr-gdb fails to build using clang
Summary: devel/avr-gdb fails to build using clang
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Joerg Wunsch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-01 14:50 UTC by Miklos Magyari
Modified: 2013-10-18 11:00 UTC (History)
0 users

See Also:


Attachments
file.diff (206 bytes, patch)
2012-10-01 14:50 UTC, Miklos Magyari
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Magyari 2012-10-01 14:50:01 UTC
devel/avr-gbd fails to build using clang:

[...snip...]

/bin/sh ./libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I. -I. -I./../include  -DHAVE_bfd_elf32_avr_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -O2 -pipe -fno-strict-aliasing -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c -o bfdio.lo bfdio.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_bfd_elf32_avr_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -O2 -pipe -fno-strict-aliasing -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c bfdio.c -o bfdio.o
bfdio.c:580:31: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror,-Wsizeof-pointer-memaccess]
  memset (statbuf, 0, sizeof (statbuf));
          ~~~~~~~             ^~~~~~~
1 error generated.
gmake[4]: *** [bfdio.lo] Error 1
gmake[4]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[1]: *** [all-bfd] Error 2
gmake[1]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1'
gmake: *** [all] Error 2
*** Error code 1

Stop in /a/ports/devel/avr-gdb.

Fix: patch to the port Makefile:

+CFLAGS+=       -Wno-unused-value
+
 pre-configure:
        cd ${WRKSRC} ; ${RM} -rf dejagnu expect tcl texinfo


another patch in needed under files/ :

a# cat files/patch-bfd::bfdio.c


-  memset (statbuf, 0, sizeof (statbuf));
+  memset (statbuf, 0, sizeof (struct stat));
   statbuf->st_size = bim->size;

   return 0;--X3C0CV1rCDOjQ8aDMxviSiESVeZJK91y5Py4xpPHEbNmTR8S
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- Makefile.orig       2012-10-01 15:45:38.000000000 +0200
+++ Makefile    2012-10-01 15:26:38.000000000 +0200
@@ -22,6 +22,8 @@
 GNU_CONFIGURE= yes
 CONFIGURE_ARGS=        --target=avr --program-prefix=avr --disable-nls
How-To-Repeat: # cd /usr/ports/devel/avr-gdb
# make
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-10-08 07:04:06 UTC
Responsible Changed
From-To: freebsd-ports-bugs->joerg

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2013-10-18 10:59:51 UTC
Author: tijl
Date: Fri Oct 18 09:59:43 2013
New Revision: 330734
URL: http://svnweb.freebsd.org/changeset/ports/330734

Log:
  Fix two bugs reported by clang.
  
  PR:		ports/172209
  Submitted by:	Miklos Magyari <magyarimiki@gmail.com>
  Approved by:	maintainer timeout (1 year)

Added:
  head/devel/avr-gdb/files/patch-bfd-bfdio.c   (contents, props changed)
  head/devel/avr-gdb/files/patch-bfd-elflink.c   (contents, props changed)
Modified:
  head/devel/avr-gdb/Makefile

Modified: head/devel/avr-gdb/Makefile
==============================================================================
--- head/devel/avr-gdb/Makefile	Fri Oct 18 09:56:47 2013	(r330733)
+++ head/devel/avr-gdb/Makefile	Fri Oct 18 09:59:43 2013	(r330734)
@@ -3,7 +3,7 @@
 
 PORTNAME=	gdb
 PORTVERSION=	7.3.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_GNU}
 MASTER_SITE_SUBDIR=	gdb

Added: head/devel/avr-gdb/files/patch-bfd-bfdio.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/avr-gdb/files/patch-bfd-bfdio.c	Fri Oct 18 09:59:43 2013	(r330734)
@@ -0,0 +1,11 @@
+--- bfd/bfdio.c.orig
++++ bfd/bfdio.c
+@@ -577,7 +577,7 @@
+ {
+   struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
+ 
+-  memset (statbuf, 0, sizeof (statbuf));
++  memset (statbuf, 0, sizeof (*statbuf));
+   statbuf->st_size = bim->size;
+ 
+   return 0;

Added: head/devel/avr-gdb/files/patch-bfd-elflink.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/avr-gdb/files/patch-bfd-elflink.c	Fri Oct 18 09:59:43 2013	(r330734)
@@ -0,0 +1,11 @@
+--- bfd/elflink.c.orig
++++ bfd/elflink.c
+@@ -12456,7 +12456,7 @@
+ 		   abfd, sec);
+ 	      else if (sec->size != 0)
+ 		{
+-		  bfd_byte *sec_contents, *l_sec_contents;
++		  bfd_byte *sec_contents = NULL, *l_sec_contents = NULL;
+ 
+ 		  if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
+ 		    (*_bfd_error_handler)
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Tijl Coosemans freebsd_committer freebsd_triage 2013-10-18 11:00:03 UTC
State Changed
From-To: open->closed

Committed in r330734.