Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Sep 1998 14:42:23 -0500 (EST)
From:      Don Croyle <croyle@gelemna.ft-wayne.in.us>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/7855: cpp should define __ELF__ if objformat = elf
Message-ID:  <199809071942.OAA02194@emerson.gelemna.ft-wayne.in.us>

next in thread | raw e-mail | index | archive | help

>Number:         7855
>Category:       bin
>Synopsis:       cpp should define __ELF__ if objformat = elf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep  7 12:50:03 PDT 1998
>Last-Modified:
>Originator:     Don Croyle
>Organization:
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:
A post E-day -current.
	

>Description:
Cpp doesn't define __ELF__ when the object format is elf.  I don't
believe that anything in the core OS uses cpp, but I know at least one
port that cares about __ELF__ does (archivers/zip).
	

>How-To-Repeat:
On a system where the default object format is elf:

touch foo.c
cc -E -dM foo.c
cpp -dM foo.c

Note the __ELF__ is listed in the former but not the latter output.
	

>Fix:
Since /usr/bin/cpp is a wrapper script, fixing it seems less intrusive
than grafting objformat's functionality into /usr/libexec/cpp.

This patch does that:

*** usr.bin/cpp/cpp.sh.orig	Sat Feb 22 14:54:47 1997
--- usr.bin/cpp/cpp.sh	Mon Sep  7 02:32:17 1998
***************
*** 50,55 ****
--- 50,60 ----
  INCS="-nostdinc"
  FOUNDFILES=no
  
+ if [ `objformat` = "elf" ]
+ then
+ 	ALST="$ALST -D__ELF__"
+ fi
+ 
  for A
  do
  	case $A in

	

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809071942.OAA02194>